home *** CD-ROM | disk | FTP | other *** search
/ Giga Games 1 / Giga Games.iso / net / usenet / volume7 / nethack3 / patch8v < prev    next >
Encoding:
Internet Message Format  |  1990-06-08  |  60.1 KB

  1. Path: uunet!tut.cis.ohio-state.edu!ucsd!ogicse!zephyr.ens.tek.com!tekred!saab!billr
  2. From: billr@saab.CNA.TEK.COM (Bill Randle)
  3. Newsgroups: comp.sources.games
  4. Subject: v10i040:  NetHack3 -  display oriented dungeons & dragons (Ver. 3.0), Patch8v
  5. Message-ID: <5748@tekred.CNA.TEK.COM>
  6. Date: 5 Jun 90 18:03:45 GMT
  7. Sender: news@tekred.CNA.TEK.COM
  8. Lines: 2141
  9. Approved: billr@saab.CNA.TEK.COM
  10. Posted: Tue Jun  5 11:03:45 1990
  11.  
  12. Submitted-by: Izchak Miller <izchak@linc.cis.upenn.edu>
  13. Posting-number: Volume 10, Issue 40
  14. Archive-name: NetHack3/Patch8v
  15. Patch-To: NetHack3: Volume 7, Issue 56-93
  16.  
  17.  
  18.  
  19. #! /bin/sh
  20. # This is a shell archive.  Remove anything before this line, then unpack
  21. # it by saving it into a file and typing "sh file".  To overwrite existing
  22. # files, type "sh file -c".  You can also feed this as standard input via
  23. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  24. # will see the following message at the end:
  25. #        "End of archive 22 (of 24)."
  26. # Contents:  mac/MacAlert.c others/Makefile.ovl vms/vmsbuild.com
  27. # Wrapped by billr@saab on Mon Jun  4 15:40:33 1990
  28. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  29. echo shar: Extracting \"'mac/MacAlert.c'\" \(24474 characters\)
  30. sed "s/^X//" >'mac/MacAlert.c' <<'END_OF_FILE'
  31. X/*    SCCS Id: @(#)MacAlert.c        3.0    90/01/06
  32. X/*      Copyright (c) Jon Watte  1989        */ 
  33. X/* NetHack may be freely redistributed.  See license for details. */
  34. X
  35. X#include "hack.h"    /* */
  36. X
  37. X/* UseMacAlert is like UseMacAlertText, but without the text parameter.
  38. X   This is so you can simply say "UseMacAlert(CAUTION)" or similar, if
  39. X   you use predefined alert numbers.
  40. X*/
  41. X
  42. X
  43. Xextern WindowPtr HackWindow;
  44. X
  45. X
  46. Xint
  47. XUseMacAlert(MAno)
  48. Xint MAno;
  49. X{
  50. X    return UseMacAlertText(MAno, 0L);
  51. X}
  52. X
  53. X
  54. X/* UseMacAlertText fetches a record in a resource of type MAlt, and uses
  55. X   this as a template calling MacAlert. This is so you can have ready-
  56. X   made resources, like ALRT templates, for your MacAlerts, which makes
  57. X   it easier to customize the program, and to translate it. It also
  58. X   makes for clearer code...
  59. X   
  60. X   If the txt argument is NULL, the text from the template is used,
  61. X   otherwise the sypplied text is used.
  62. X*/
  63. Xint
  64. XUseMacAlertText(MAno, txt)
  65. Xint MAno;
  66. Xchar * txt;
  67. X{
  68. X    MAlrtHandle foo;
  69. X    MAlrtPtr bar;
  70. X    int item;
  71. X
  72. X    SetResLoad(1);
  73. X    foo = (MAlrtHandle) GetResource(MAtype, MAno);
  74. X    if(foo) {
  75. X        MoveHHi(foo);
  76. X        HLock(foo);
  77. X        bar = *foo;
  78. X        item = MacAlert(bar->width, bar->height, bar->PICTno,
  79. X            txt != 0L ? txt : bar->text, bar->but1, bar->but2, bar->but3,
  80. X            bar->but4, bar->def, bar->esc);
  81. X    } else {
  82. X        if(!flags.silent) SysBeep(20);
  83. X        item = -1;
  84. X    }
  85. X
  86. X    ReleaseResource(foo);
  87. X    DisposHandle(foo);
  88. X    return item;
  89. X}
  90. X
  91. X
  92. X/* This is the MacAlert function. It creates a new window, frames it
  93. X   (like a modal dialog) and tries to position the various buttons,
  94. X   text and picture in a reasonable way. The arguments are:
  95. X   
  96. X   width : width of the window. If less than a constant, it defaults
  97. X           to that constant.
  98. X   height: see width.
  99. X   PICTno: Resource ID of a PICT to display. If 0, no PICT is displayed.
  100. X   text  : the C string containing the relevant text to be displayed.
  101. X   but1 -: These are the button texts. Empty strings (they point at 0)
  102. X   - but4: makes that button go away. If all are empty, the default OK
  103. X           button text is used.
  104. X   def   : This is which button is default, starting button # 1.
  105. X   esc   : This is the button that corresponds to the ESC key.
  106. X
  107. X   The function returns the button hit, or maybe -1 on error.
  108. X*/
  109. Xint
  110. XMacAlert(width, height, PICTno, text, but1, but2, but3, but4, def, esc)
  111. Xint width, height, PICTno;
  112. Xchar * text,* but1, * but2, * but3, * but4;
  113. Xint def, esc;
  114. X{
  115. X    PicHandle thePICT;
  116. X    char border[8];
  117. X    EventRecord theEvent;
  118. X    GrafPtr savedPort;
  119. X    WindowPtr theWindow, tmpWind;
  120. X    Rect bounds, textBox, brect[4];
  121. X    char hilite[4], * but[4], s1[2], s2[2];
  122. X    int nobutts, x, pool, spacing, heig, bwid[4],
  123. X        item, c, ret;
  124. X    long finalTicks;
  125. X
  126. X    memset(hilite, sizeof(hilite), 0);
  127. X    memset(bwid, sizeof(bwid), 0);
  128. X    SetCursor(&arrow);
  129. X    def--;
  130. X    esc--;
  131. X    GetPort(&savedPort);
  132. X
  133. X    if(PICTno)
  134. X        thePICT = (PicHandle) GetResource('PICT', PICTno);
  135. X    else
  136. X        thePICT = 0;
  137. X    if(thePICT) DetachResource(thePICT);
  138. X    bounds = (MAINGRAFPORT)->portRect;
  139. X
  140. X    but[0] = but1;
  141. X    but[1] = but2;
  142. X    but[2] = but3;
  143. X    but[3] = but4;
  144. X
  145. X    if(width > bounds.right) width = bounds.right;
  146. X    if(width < MIN_WIDTH) width = MIN_WIDTH;
  147. X    if(height > bounds.bottom) height = bounds.bottom;
  148. X    if(height < MIN_HEIGHT) height = MIN_HEIGHT;
  149. X
  150. X    InsetRect(&bounds, (int) ((bounds.right - width) >> 1), (int)
  151. X        ((bounds.bottom - height) >> 1));
  152. X    theWindow = NewWindow(0L, &bounds, "", 1, plainDBox, 0L, 0, 0L);
  153. X    ShowWindow(theWindow);
  154. X    SelectWindow(theWindow);
  155. X    SetPort(theWindow);
  156. X    OffsetRect(&bounds, - bounds.left, - bounds.top);
  157. X
  158. X    nobutts = 0;
  159. X    if(but1[0]) nobutts=1;
  160. X    if(but2[0]) nobutts=2;
  161. X    if(but3[0]) nobutts=3;
  162. X    if(but4[0]) nobutts=4;
  163. X
  164. X    if(!nobutts) {
  165. X        but[0] = "OK";
  166. X        nobutts++;
  167. X    }
  168. X
  169. X    spacing = 0;
  170. X    for(x=0 ; x < nobutts; x++) {
  171. X        bwid[x] = TextWidth(but[x], 0, strlen(but[x])) + 2 * BUT_MARGIN;
  172. X        spacing += bwid[x] + BUT_SPACING;
  173. X    }
  174. X
  175. X    pool = bounds.right - 2 * BUT_MARGIN;
  176. X
  177. X    heig = 1;
  178. X    while(spacing / heig > pool - (nobutts - 1) * BUT_SPACING) {
  179. X        heig++;
  180. X    }
  181. X
  182. X    for(x=0; x<nobutts; x++) {
  183. X        bwid[x] = (int) ((float) bwid[x] / spacing * pool);
  184. X    }
  185. X
  186. X    pool = BUT_MARGIN + BUT_SPACING;
  187. X    heig = bounds.bottom - BUT_MARGIN - BUT_SPACING - BUT_HEIGHT * heig;
  188. X    for(x=0; x<nobutts; x++) {
  189. X        SetRect(&(brect[x]), pool, heig, pool + bwid[x], bounds.bottom -
  190. X            BUT_SPACING - BUT_MARGIN);
  191. X        pool += bwid[x] + BUT_SPACING;
  192. X        hilite[x] = 0;
  193. X    }
  194. X
  195. X    InsetRect(&bounds, 2, 2);
  196. X    textBox = bounds;
  197. X    if(thePICT) {
  198. X        textBox.left += (*thePICT)->picFrame.right;
  199. X    }
  200. X    textBox.left += 8;
  201. X    textBox.right -= 8;
  202. X    textBox.top += 8;
  203. X    textBox.bottom = heig - BUT_MARGIN;
  204. X    if(textBox.bottom < textBox.top + 15) {
  205. X        textBox.bottom = bounds.bottom - 8;
  206. X    }
  207. X
  208. X    goto mainLoop;
  209. X
  210. XdrawWindow:
  211. X    SetPort(theWindow);
  212. X    EraseRect(&(theWindow->portRect));
  213. X    PenNormal();
  214. X    PenSize(BORDER_WIDTH, BORDER_WIDTH);
  215. X    GetIndPattern((void *) border, 0, BORDER_PAT);
  216. X    PenPat(border);
  217. X    FrameRect(&bounds);
  218. X
  219. X    PenNormal();
  220. X
  221. X    if(thePICT) {
  222. X        HLock(thePICT);
  223. X        DrawPicture(thePICT, &((*thePICT)->picFrame));
  224. X        HUnlock(thePICT);
  225. X    }
  226. X
  227. X    PenNormal();
  228. X    TextFont(0);
  229. X    TextSize(12);
  230. X    TextBox(text, strlen(text), &textBox, teJustLeft);
  231. X
  232. X    for(x=0; x<nobutts; x++) {
  233. X        EraseRoundRect(&(brect[x]), BUT_CORNER, BUT_CORNER);
  234. X        FrameRoundRect(&(brect[x]), BUT_CORNER, BUT_CORNER);
  235. X        InsetRect(&(brect[x]), BUT_MARGIN, 3);
  236. X        TextBox(but[x], strlen(but[x]), &(brect[x]), teJustCenter);
  237. X        InsetRect(&(brect[x]), - BUT_MARGIN, - 3);
  238. X        if(hilite[x]) {
  239. X            InvertRoundRect(&(brect[x]), BUT_CORNER, BUT_CORNER);
  240. X        }
  241. X        if(x == def) {
  242. X            PenSize(FRAME_WIDTH, FRAME_WIDTH);
  243. X            InsetRect(&(brect[x]), - FRAME_WIDTH - FRAME_OFFSET,
  244. X                - FRAME_WIDTH - FRAME_OFFSET);
  245. X            FrameRoundRect(&(brect[x]), FRAME_CORNER, FRAME_CORNER);
  246. X            InsetRect(&(brect[x]), FRAME_WIDTH + FRAME_OFFSET,
  247. X                FRAME_WIDTH + FRAME_OFFSET);
  248. X            PenNormal();
  249. X        }
  250. X    }
  251. X
  252. XmainLoop:
  253. X    while(1) {
  254. X        if(WaitNextEvent(-1, &theEvent, 10L, 0L)) {
  255. X            switch(theEvent.what) {
  256. X
  257. X            case updateEvt :
  258. X                BeginUpdate((WindowPtr) theEvent.message);
  259. X                EndUpdate((WindowPtr) theEvent.message);
  260. X                goto drawWindow;
  261. X
  262. X            case mouseDown :
  263. X                if (FindWindow(theEvent.where, &tmpWind) < inContent ||
  264. X                    tmpWind != theWindow) {
  265. X                    if(!flags.silent) SysBeep(20);
  266. X                    item = -1;
  267. X                } else {
  268. X                    item = TrackThem(brect, hilite, nobutts);
  269. X                }
  270. X                if(item >= 0) {
  271. X                    Delay(FLASH_TIME, &finalTicks);
  272. X                    InvertRoundRect(&(brect[item]), BUT_CORNER, BUT_CORNER);
  273. X                    ret = item + 1;
  274. X                    goto getout;
  275. X                }
  276. X                break;
  277. X
  278. X            case keyDown :
  279. X                c = theEvent.message & 0xFF;
  280. X                if((c == 13) || (c == 3)) {
  281. X                    if(def >= 0) {
  282. X                        InvertRoundRect(&(brect[def]), BUT_CORNER, BUT_CORNER);
  283. X                        Delay(FLASH_TIME, &finalTicks);
  284. X                        InvertRoundRect(&(brect[def]), BUT_CORNER, BUT_CORNER);
  285. X                        ret = def + 1;
  286. X                        goto getout;
  287. X                    }
  288. X                }
  289. X                if(c == 27) {
  290. X                    if(esc >= 0) {
  291. X                        InvertRoundRect(&(brect[esc]), BUT_CORNER, BUT_CORNER);
  292. X                        Delay(FLASH_TIME, &finalTicks);
  293. X                        InvertRoundRect(&(brect[esc]), BUT_CORNER, BUT_CORNER);
  294. X                        ret = esc + 1;
  295. X                        goto getout;
  296. X                    }
  297. X                }
  298. X                for(x=0; x<nobutts; x++) {
  299. X                    s1[0] = 1;
  300. X                    s1[1] = c;
  301. X                    s2[0] = 1;
  302. X                    s2[1] = but[x][0];
  303. X                    UprString(s1, 1);
  304. X                    UprString(s2, 1);
  305. X                    if(s1[1] == s2[1]) {
  306. X                        InvertRoundRect(&(brect[x]), BUT_CORNER, BUT_CORNER);
  307. X                        Delay(FLASH_TIME, &finalTicks);
  308. X                        InvertRoundRect(&(brect[x]), BUT_CORNER, BUT_CORNER);
  309. X                        ret = x + 1;
  310. X                        goto getout;
  311. X                    }
  312. X                }
  313. X
  314. X                PenSize(FRAME_WIDTH, FRAME_WIDTH);
  315. X                InsetRect(&(brect[def]), - FRAME_WIDTH - FRAME_OFFSET,
  316. X                    - FRAME_WIDTH - FRAME_OFFSET);
  317. X                PenMode(patXor);
  318. X                FrameRoundRect(&(brect[def]), FRAME_CORNER, FRAME_CORNER);
  319. X                InsetRect(&(brect[def]), FRAME_WIDTH + FRAME_OFFSET,
  320. X                    FRAME_WIDTH + FRAME_OFFSET);
  321. X                PenNormal();
  322. X
  323. X                def++;
  324. X                def %= nobutts;
  325. X
  326. X                PenSize(FRAME_WIDTH, FRAME_WIDTH);
  327. X                InsetRect(&(brect[def]), - FRAME_WIDTH - FRAME_OFFSET,
  328. X                    - FRAME_WIDTH - FRAME_OFFSET);
  329. X                FrameRoundRect(&(brect[def]), FRAME_CORNER, FRAME_CORNER);
  330. X                InsetRect(&(brect[def]), FRAME_WIDTH + FRAME_OFFSET,
  331. X                    FRAME_WIDTH + FRAME_OFFSET);
  332. X                PenNormal();
  333. X
  334. X                break;
  335. X
  336. X            default:
  337. X                ;
  338. X            }
  339. X        }
  340. X    }
  341. X
  342. Xgetout:
  343. X    DisposeWindow(theWindow);
  344. X    if(thePICT) DisposHandle(thePICT);
  345. X    SetPort(savedPort);
  346. X
  347. X    return ret;
  348. X}
  349. X
  350. X
  351. X/* TrackThem is a help function to MacAlert, it tracks buttons,
  352. X   returns the button number (0 - (no_butts-1)) or -1 if no button
  353. X   was hit. */
  354. Xint
  355. XTrackThem(b_rect, hi_lite, no_butts)
  356. XRect * b_rect;
  357. Xchar * hi_lite;
  358. Xint no_butts;
  359. X{
  360. XPoint p;
  361. Xint x, i;
  362. X
  363. X    while(Button()) {
  364. X        SystemTask();
  365. X        GetMouse(&p);
  366. X        for(x=0; x<no_butts; x++) {
  367. X            if(PtInRect(p, &(b_rect[x]))) {
  368. X                if(!hi_lite[x]) {
  369. X                    hi_lite[x] = 1;
  370. X                    InvertRoundRect(&(b_rect[x]), BUT_CORNER, BUT_CORNER);
  371. X                }
  372. X            } else {
  373. X                if(hi_lite[x]) {
  374. X                    hi_lite[x] = 0;
  375. X                    InvertRoundRect(&(b_rect[x]), BUT_CORNER, BUT_CORNER);
  376. X                }
  377. X            }
  378. X        }
  379. X    }
  380. X
  381. X    i = -1;
  382. X    for(x=0; x<no_butts; x++) {
  383. X        if(hi_lite[x]) i=x;
  384. X    }
  385. X
  386. X    return i;
  387. X}
  388. X
  389. X
  390. X/* #defines for the mini-pager */
  391. X
  392. X#define SLACK 400 /* How much extra is taken per chunk ? */
  393. X#define TAB_SIZE 8 /* How large tabs ? */
  394. X
  395. X#define X_POS 8 /* Window init pos */
  396. X#define Y_POS 64
  397. X#define X_SIZE 80 /* Window size */
  398. X#define Y_SIZE 24
  399. X#define X_BORDER 20 /* Extra space besides text */
  400. X#define Y_BORDER 4
  401. X#define TOP_MARGIN 2 /* Offset of text from border */
  402. X#define LEFT_MARGIN 2
  403. X#define MAX_LINE_LEN 128
  404. X
  405. X#include <ControlMgr.h>
  406. X
  407. Xtypedef struct select {
  408. X    long start;
  409. X    long end;
  410. X    long startline;
  411. X    long endline;
  412. X} SELECTION;
  413. X
  414. Xextern WindowPtr HackWindow;
  415. X
  416. Xstatic WindowPtr PagerWindow;
  417. Xstatic width, height;
  418. Xstatic Handle theData;
  419. Xstatic long length, textPos;
  420. Xstatic Rect text_area;
  421. Xstatic Rect windowSize;
  422. Xstatic int inited;
  423. Xstatic ControlHandle theScrollBar;
  424. Xstatic int scrollMax = 0, scrollPt = 0;
  425. Xstatic long ** lineStarts;
  426. Xstatic long noRs;
  427. Xstatic MenuHandle editMenuH;
  428. Xstatic SELECTION theSelect, oldSelect;
  429. X
  430. Xint DoMenu(long selection);
  431. Xvoid DoScroll(long amount);
  432. X
  433. X
  434. X/* The mini-pager */
  435. X
  436. X
  437. Xlong
  438. XLineLength(long from, long lines)
  439. X{
  440. Xlong ndx;
  441. X    if(lines + from > noRs) ndx = noRs;
  442. X    else ndx = lines + from;
  443. X    return (*lineStarts)[ndx] - (*lineStarts)[from];
  444. X}
  445. X
  446. X
  447. Xlong
  448. XWhatOffset(Point p, long * line)
  449. X{
  450. Xint x, y;
  451. Xlong l, ndx;
  452. X
  453. X    x = (p.h - LEFT_MARGIN) / width;
  454. X    if(x < 0) x = 0;
  455. X    y = (p.v - TOP_MARGIN) / height;
  456. X    if(y < 0) {
  457. X        y = 0;
  458. X        DoScroll(-1);
  459. X    } else if(y >= Y_SIZE) {
  460. X        y = Y_SIZE;
  461. X        DoScroll(1);
  462. X    }
  463. X    l = y + scrollPt > noRs-1 ? noRs-1 : y + scrollPt;
  464. X    ndx = x + (*lineStarts)[l];
  465. X    if(l == noRs) ndx = length;
  466. X    else if(ndx > (*lineStarts)[l+1]) ndx = (*lineStarts)[l+1];
  467. X
  468. X    * line = l;
  469. X    return ndx;
  470. X}
  471. X
  472. X
  473. Xvoid
  474. XInvertRange(SELECTION * s, Rect * cr)
  475. X{
  476. Xlong sc = s->start;
  477. Xlong ec = s->end;
  478. Xlong sl = s->startline;
  479. Xlong el = s->endline;
  480. Xint sx, ex;
  481. XRect r;
  482. X
  483. X#define HilitePtr (void *) 0x938
  484. X
  485. X    if(sc > ec) {
  486. X    long t = sc;
  487. X        sc = ec;
  488. X        ec = t;
  489. X        t = sl;
  490. X        sl = el;
  491. X        el = t;
  492. X    }
  493. X
  494. X    sx = sc - (*lineStarts)[sl];
  495. X    ex = ec - (*lineStarts)[el];
  496. X    sl -= scrollPt;
  497. X    el -= scrollPt;
  498. X    r = text_area;
  499. X    ClipRect(cr ? cr : &r);
  500. X    if(el == sl) {
  501. X        SetRect(&r, sx * width, sl * height, ex * width, (el + 1) * height);
  502. X        OffsetRect(&r, LEFT_MARGIN, TOP_MARGIN);
  503. X        BitClr(HilitePtr, pHiliteBit);
  504. X        InvertRect(&r);
  505. X    } else {
  506. X        SetRect(&r, sx * width, sl * height, X_SIZE * width, (sl + 1) * height);
  507. X        OffsetRect(&r, LEFT_MARGIN, TOP_MARGIN);
  508. X        BitClr(HilitePtr, pHiliteBit);
  509. X        InvertRect(&r);
  510. X        SetRect(&r, 0, el * height, ex * width, (el + 1) * height);
  511. X        OffsetRect(&r, LEFT_MARGIN, TOP_MARGIN);
  512. X        BitClr(HilitePtr, pHiliteBit);
  513. X        InvertRect(&r);
  514. X        SetRect(&r, 0, (sl + 1) * height, X_SIZE * width, el * height);
  515. X        OffsetRect(&r, LEFT_MARGIN, TOP_MARGIN);
  516. X        BitClr(HilitePtr, pHiliteBit);
  517. X        InvertRect(&r);
  518. X    }
  519. X    SetRect(&r, 0, 0, 20000, 20000);
  520. X    ClipRect(&r);
  521. X}
  522. X
  523. X
  524. Xvoid
  525. XDoDraw(EventRecord * theEvent, term_info * t)
  526. X{
  527. X    BeginUpdate((WindowPtr) theEvent->message);
  528. X    if(StripAddress(theEvent->message) == StripAddress(HackWindow)) {
  529. X        SetPort(HackWindow);
  530. X        docrt();
  531. X    } else if(StripAddress(theEvent->message) == StripAddress(PagerWindow)) {
  532. X        MoveHHi(theData);
  533. X        HLock(theData);
  534. X        MoveHHi(lineStarts);
  535. X        DrawControls(PagerWindow);
  536. X        TextBox(&((*theData)[(*lineStarts)[textPos]]), LineLength(textPos,
  537. X            Y_SIZE), &text_area, teJustLeft);
  538. X        HUnlock(theData);
  539. X        InvertRange(&theSelect, 0L);
  540. X    }
  541. X    EndUpdate((WindowPtr) theEvent->message);
  542. X}
  543. X
  544. X
  545. Xvoid
  546. XDoScroll(long amount)
  547. X{
  548. Xint ab = amount > 0 ? amount : - amount;
  549. X
  550. X    if(textPos == 0 && amount < 0) return;
  551. X    if(textPos == scrollMax && amount > 0) return;
  552. X
  553. X    textPos += amount;
  554. X    if(textPos < 0) {
  555. X        amount -= textPos;
  556. X        textPos = 0;
  557. X    }
  558. X    if(textPos > scrollMax) {
  559. X        amount -= textPos - scrollMax;
  560. X        textPos = scrollMax;
  561. X    }
  562. X    scrollPt = textPos;
  563. X
  564. X    if(ab > Y_SIZE - 1) {
  565. X        HLock(theData);
  566. X        TextBox(&((*theData)[(*lineStarts)[textPos]]), LineLength(textPos,
  567. X            ab), &text_area, teJustLeft);
  568. X        HUnlock(theData);
  569. X        InvertRange(&theSelect, (Rect *) 0L);
  570. X    } else {
  571. X    Rect r;
  572. X    RgnHandle rgn = NewRgn();
  573. X        r = text_area;
  574. X        ScrollRect(&text_area, 0, - amount * height, rgn);
  575. X        DisposHandle(rgn);
  576. X        if(amount < 0) {
  577. X            r.bottom -= (Y_SIZE - ab) * height;
  578. X            HLock(theData);
  579. X            TextBox(&((*theData)[(*lineStarts)[textPos]]), LineLength
  580. X                (textPos, ab), &r, teJustLeft);
  581. X            HUnlock(theData);
  582. X            InvertRange(&theSelect, &r);
  583. X        } else {
  584. X            r.top += (Y_SIZE - ab) * height;
  585. X            HLock(theData);
  586. X            TextBox(&((*theData)[(*lineStarts)[textPos + Y_SIZE - ab]]),
  587. X                LineLength(textPos + Y_SIZE - ab, ab), &r,
  588. X                teJustLeft);
  589. X            HUnlock(theData);
  590. X            InvertRange(&theSelect, &r);
  591. X        }
  592. X    }
  593. X    SetCtlValue(theScrollBar, scrollPt);
  594. X    DrawControls(PagerWindow);
  595. X}
  596. X
  597. X
  598. Xpascal void
  599. XLineUp(ControlHandle stl, int part)
  600. X{
  601. X    DoScroll(-1);
  602. X}
  603. X
  604. Xpascal void
  605. XLineDown(ControlHandle stl, int part)
  606. X{
  607. X    DoScroll(1);
  608. X}
  609. X
  610. Xpascal void
  611. XPageUp(ControlHandle stl, int part)
  612. X{
  613. X    DoScroll(- Y_SIZE + 1);
  614. X}
  615. X
  616. Xpascal void
  617. XPageDown(ControlHandle stl, int part)
  618. X{
  619. X    DoScroll(Y_SIZE - 1);
  620. X}
  621. X
  622. X
  623. Xint
  624. XDoKey(EventRecord * theEvent, term_info * t)
  625. X{
  626. Xchar c = theEvent->message & 0xFF;
  627. Xchar k = (theEvent->message & 0xFF00) >> 8;
  628. X
  629. X    switch(k) {
  630. X
  631. X    case 0x7A:
  632. X        DoMenu((long)(editMenu << 16) | 1);
  633. X        return 1;
  634. X
  635. X    case 0x78:
  636. X        DoMenu((long)(editMenu << 16) | 3);
  637. X        return 1;
  638. X
  639. X    case 0x63:
  640. X        DoMenu((long)(editMenu << 16) | 4);
  641. X        return 1;
  642. X
  643. X    case 0x76:
  644. X        DoMenu((long)(editMenu << 16) | 5);
  645. X        return 1;
  646. X
  647. X    case 0x7E:
  648. X    case 0x7B:
  649. X        if(theEvent->modifiers & (optionKey | shiftKey | cmdKey))
  650. X            DoScroll(- Y_SIZE + 1);
  651. X        else DoScroll(-1);
  652. X        return 1;
  653. X
  654. X    case 0x7C:
  655. X    case 0x7D:
  656. X        if(theEvent->modifiers & (optionKey | shiftKey | cmdKey))
  657. X            DoScroll(Y_SIZE - 1);
  658. X        else DoScroll(1);
  659. X        return 1;
  660. X
  661. X    case 0x73:
  662. X        DoScroll(-scrollMax);
  663. X        return 1;
  664. X
  665. X    case 0x77:
  666. X        DoScroll(scrollMax);
  667. X        return 1;
  668. X
  669. X    case 0x74:
  670. X        DoScroll(1 - Y_SIZE);
  671. X        return 1;
  672. X        
  673. X    case 0x79:
  674. X        DoScroll(Y_SIZE - 1);
  675. X        return 1;
  676. X        
  677. X    case 0x7F:
  678. X        return 0;
  679. X
  680. X    default:
  681. X        break;
  682. X    }
  683. X
  684. X    switch(c) {
  685. X
  686. X    case 'c':
  687. X    case 'C':
  688. X        if(theEvent->modifiers & cmdKey) {
  689. X            HiliteMenu(editMenu);
  690. X            DoMenu((long)(editMenu << 16) | 4);
  691. X            HiliteMenu(0);
  692. X        }
  693. X        return 1;
  694. X
  695. X    case '.':
  696. X        if(!(theEvent->modifiers & cmdKey)) break;
  697. X    case 'q':
  698. X    case 'Q':
  699. X    case 0x1B:
  700. X        return 0;
  701. X
  702. X    case ' ':
  703. X    case 0x9:
  704. X        if(theEvent->modifiers & (optionKey | shiftKey | cmdKey))
  705. X            DoScroll(- Y_SIZE + 1);
  706. X        else DoScroll(Y_SIZE - 1);
  707. X        break;
  708. X
  709. X    case 0x3:
  710. X    case '\r':
  711. X    case '\n':
  712. X        if(theEvent->modifiers & (optionKey | shiftKey | cmdKey))
  713. X            DoScroll(-1);
  714. X        else DoScroll(1);
  715. X        break;
  716. X
  717. X    case '<':
  718. X        DoScroll(- scrollMax);
  719. X        break;
  720. X
  721. X    case '>':
  722. X        DoScroll(scrollMax);
  723. X        break;
  724. X
  725. X    default:
  726. X        break;
  727. X    }
  728. X
  729. X    return 1;
  730. X}
  731. X
  732. X
  733. Xvoid
  734. XDoClick(EventRecord * theEvent, term_info * t)
  735. X{
  736. XControlHandle control;
  737. XPoint pt = theEvent->where;
  738. Xint part;
  739. X
  740. X    GlobalToLocal(&pt);
  741. X    part = FindControl(pt, PagerWindow, &control);
  742. X    if(part) {
  743. X        switch(part) {
  744. X
  745. X        case inThumb:
  746. X            if(TrackControl(control, pt, 0L) == inThumb) {
  747. X                scrollPt = GetCtlValue(control);
  748. X                DoScroll(scrollPt - textPos);
  749. X            }
  750. X            break;
  751. X
  752. X        case inUpButton:
  753. X            TrackControl(control, pt, LineUp);
  754. X            break;
  755. X
  756. X        case inDownButton:
  757. X            TrackControl(control, pt, LineDown);
  758. X            break;
  759. X
  760. X        case inPageUp:
  761. X            TrackControl(control, pt, PageUp);
  762. X            break;
  763. X
  764. X        case inPageDown:
  765. X            TrackControl(control, pt, PageDown);
  766. X            break;
  767. X
  768. X        default:
  769. X            break;
  770. X        }
  771. X    } else {
  772. X        if(theEvent->modifiers & shiftKey) {
  773. X            theSelect.end = WhatOffset(pt, &(theSelect.endline));
  774. X            oldSelect.start = theSelect.end;
  775. X            oldSelect.startline = theSelect.endline;
  776. X            InvertRange(&oldSelect, (Rect *) 0L);
  777. X            oldSelect = theSelect;
  778. X        } else {
  779. X            InvertRange(&theSelect, (Rect *) 0L);
  780. X            theSelect.start = WhatOffset(pt, &(theSelect.startline));
  781. X            theSelect.end = theSelect.start;
  782. X            theSelect.endline = theSelect.startline;
  783. X            InvertRange(&theSelect, (Rect *) 0L);
  784. X            oldSelect = theSelect;
  785. X        }
  786. X        while(StillDown()) {
  787. X            GetMouse(&pt);
  788. X            theSelect.end = WhatOffset(pt, &(theSelect.endline));
  789. X            oldSelect.start = theSelect.end;
  790. X            oldSelect.startline = theSelect.endline;
  791. X            InvertRange(&oldSelect, (Rect *) 0L);
  792. X            oldSelect = theSelect;
  793. X        }
  794. X        if(theSelect.start > theSelect.end) {
  795. X        long t = theSelect.start;
  796. X            theSelect.start = theSelect.end;
  797. X            theSelect.end = t;
  798. X            t = theSelect.startline;
  799. X            theSelect.startline = theSelect.endline;
  800. X            theSelect.endline = t;
  801. X            oldSelect = theSelect;
  802. X        }
  803. X    }
  804. X}
  805. X
  806. X
  807. Xint
  808. XDoMenu(long selection)
  809. X{
  810. Xint menu = HiWord(selection);
  811. Xint item = LoWord(selection);
  812. X
  813. X    switch(menu) {
  814. X
  815. X    case fileMenu:
  816. X        if(item == 9) return 0;
  817. X        if(item == 4) {
  818. X        Rect foom = PagerWindow->portRect;
  819. X            OffsetRect(&foom, -foom.left, -foom.top);
  820. X            InvalRect(&foom);
  821. X            return 1;
  822. X        }
  823. X        break;
  824. X
  825. X    case editMenu:
  826. X        switch(item) {
  827. X
  828. X        case 1:
  829. X            SysBeep(20);
  830. X            break;
  831. X
  832. X        case 3:
  833. X            SysBeep(20);
  834. X            break;
  835. X
  836. X        case 4:
  837. X            if(theSelect.start == theSelect.end) {
  838. X                SysBeep(20);
  839. X            } else {
  840. X                ZeroScrap();
  841. X                HLock(theData);
  842. X                PutScrap(theSelect.end - theSelect.start, 'TEXT', &((*theData)
  843. X                    [theSelect.start]));
  844. X                HUnlock(theData);
  845. X            }
  846. X            break;
  847. X
  848. X        case 5:
  849. X            SysBeep(20);
  850. X            break;
  851. X
  852. X        default:
  853. X            break;
  854. X
  855. X        }
  856. X        break;
  857. X
  858. X    default:
  859. X        break;
  860. X
  861. X    }
  862. X
  863. X    return 1;
  864. X}
  865. X
  866. X
  867. Xint
  868. XDoMDown(EventRecord * theEvent, term_info * t)
  869. X{
  870. XWindowPtr whatWindow;
  871. Xint where;
  872. X
  873. X    where = FindWindow(theEvent->where, &whatWindow);
  874. X    switch(where) {
  875. X
  876. X    case inMenuBar:
  877. X        if(theSelect.start != theSelect.end) {
  878. X            EnableItem(editMenuH, 4);
  879. X        } else {
  880. X            DisableItem(editMenuH, 4);
  881. X        }
  882. X        where = DoMenu(MenuSelect(theEvent->where));
  883. X        HiliteMenu(0);
  884. X        return where;
  885. X
  886. X    case inGrow:
  887. X    case inContent:
  888. X        if(StripAddress(whatWindow) == StripAddress(PagerWindow)) {
  889. X            DoClick(theEvent, t);
  890. X        } else {
  891. X            SysBeep(20);
  892. X        }
  893. X        break;
  894. X
  895. X    case inDrag:
  896. X        if(StripAddress(whatWindow) == StripAddress(PagerWindow)) {
  897. X        RgnHandle theRgn = GetGrayRgn();
  898. X        Point p;
  899. X            DragWindow(PagerWindow, theEvent->where, &((*theRgn)->rgnBBox));
  900. X            windowSize = PagerWindow->portRect;
  901. X            p.h = windowSize.left;
  902. X            p.v = windowSize.top;
  903. X            LocalToGlobal(&p);
  904. X            OffsetRect(&windowSize, p.h, p.v);
  905. X        } else {
  906. X            SysBeep(20);
  907. X        }
  908. X        break;
  909. X
  910. X    case inGoAway:
  911. X        if(TrackGoAway(PagerWindow, theEvent->where)) return 0;
  912. X        break;
  913. X
  914. X    default:
  915. X        break;
  916. X
  917. X    }
  918. X    return 1;
  919. X}
  920. X
  921. X
  922. Xint
  923. XCheckEvent(EventRecord * theEvent, term_info * t)
  924. X{
  925. X    switch(theEvent->what) {
  926. X
  927. X    case autoKey:
  928. X    case keyDown:
  929. X        return DoKey(theEvent, t);
  930. X        break;
  931. X
  932. X    case updateEvt:
  933. X        DoDraw(theEvent, t);
  934. X        break;
  935. X
  936. X    case mouseDown:
  937. X        return DoMDown(theEvent, t);
  938. X        break;
  939. X
  940. X    case activateEvt:
  941. X        if(theEvent->modifiers & 1) {
  942. X            ShowControl(theScrollBar);
  943. X        } else {
  944. X            HideControl(theScrollBar);
  945. X        }
  946. X        break;
  947. X
  948. X    case app4Evt:
  949. X        if(theEvent->message >> 24 == 1) {
  950. X            if(theEvent->message & 1) {
  951. X                HiliteControl(theScrollBar, scrollMax ? 0 : 254);
  952. X            } else {
  953. X                HiliteControl(theScrollBar, 255);
  954. X            }
  955. X        }
  956. X
  957. X    default:
  958. X        break;
  959. X    }
  960. X
  961. X    return 1;
  962. X}
  963. X
  964. X
  965. Xvoid
  966. XMagicDisplay(term_info * t)
  967. X{
  968. XEventRecord theEvent;
  969. X
  970. X    SetCursor(&ARROW_CURSOR);
  971. X    do {
  972. X        WaitNextEvent(everyEvent, &theEvent, 42L, 0L);
  973. X        SetPort(PagerWindow);
  974. X    } while(CheckEvent(&theEvent, t));
  975. X}
  976. X
  977. X
  978. Xint
  979. XCountChars(char * s, long n, int c)
  980. X{
  981. Xint r = 0;
  982. X
  983. X    while(n-- > 0) if(*(s++) == c) r++;
  984. X
  985. X    return r;
  986. X}
  987. X
  988. X
  989. Xint
  990. XTabSize(char * s)
  991. X{
  992. Xint r = 0, q;
  993. X
  994. X    for(q = 0; s[q]; q++)
  995. X        r += (s[q] == '\t') ? 8 - (r & 7) : 1;
  996. X
  997. X    return r;
  998. X}
  999. X
  1000. X
  1001. Xint
  1002. XExpandTabs(char * s, char * d)
  1003. X{
  1004. Xint r, q, c = 0, t = 0;
  1005. X
  1006. X    for(q = 0; s[q]; q++)
  1007. X        switch(s[q]) {
  1008. X
  1009. X        case '\t':
  1010. X            for(r = 0; r < 8 - (t & 7); r++, c++)
  1011. X                *(d++) = 0x20;
  1012. X            t += 8 - (t & 7);
  1013. X            break;
  1014. X
  1015. X        case '\n':
  1016. X            *(d++) = '\r';
  1017. X            c++;
  1018. X            t = 0;
  1019. X            break;
  1020. X
  1021. X        default:
  1022. X            *(d++) = s[q];
  1023. X            c++;
  1024. X            t++;
  1025. X            break;
  1026. X        }
  1027. X
  1028. X    return c;
  1029. X}
  1030. X
  1031. X
  1032. Xint
  1033. XMoofFile(FILE * fp, int strip)
  1034. X{
  1035. Xlong            fpos;
  1036. Xlong            delta_slack;
  1037. Xlong            slack_left;
  1038. Xchar            buf[MAX_LINE_LEN];
  1039. X
  1040. X    if(!fp) {
  1041. X        panic("No file for pager");
  1042. X    }
  1043. X    fpos = ftell(fp);
  1044. X    length = 0;
  1045. X    theData = NewHandle(SLACK);
  1046. X    slack_left = SLACK;
  1047. X
  1048. X    do {
  1049. X        if(!fgets(buf, MAX_LINE_LEN, fp)) break;
  1050. X        if(!strip || isspace(*buf)) {
  1051. X            delta_slack = TabSize(buf);
  1052. X            slack_left -= delta_slack;
  1053. X            if(slack_left < 0) {
  1054. X                slack_left += SLACK;
  1055. X                SetHandleSize(theData, length + SLACK + delta_slack);
  1056. X                if(MemError())
  1057. X                    panic("Out of memory");
  1058. X            }
  1059. X            MoveHHi(theData);
  1060. X            HLock(theData);
  1061. X            length += ExpandTabs(buf+strip, &((*theData)[length]));
  1062. X            HUnlock(theData);
  1063. X        }
  1064. X    } while(!feof(fp) && (isspace(*buf) || !strip));
  1065. X
  1066. X    fclose(fp);
  1067. X    return 0;
  1068. X}
  1069. X
  1070. X
  1071. Xvoid
  1072. XsetLineStarts(long ** starts, char * data, long length)
  1073. X{
  1074. Xlong x = length;
  1075. Xlong p = 0;
  1076. X
  1077. X    **starts = 0;
  1078. X    while(length--)
  1079. X        if(*(data++) == '\r')
  1080. X            (*starts)[++p] = x - length;
  1081. X}
  1082. X
  1083. X
  1084. Xvoid
  1085. XMoreDisabling(MenuHandle theMenu, int i)
  1086. X{
  1087. Xint x;
  1088. X
  1089. X    switch(i) {
  1090. X
  1091. X    default :
  1092. X        DisableItem(theMenu, 0);
  1093. X        break;
  1094. X
  1095. X    case fileMenu:
  1096. X        for(x = 1; x < 9; x++)
  1097. X            DisableItem(theMenu, x);
  1098. X        SetItem(theMenu, 9, "\PClose");
  1099. X        EnableItem(theMenu, 9);
  1100. X        EnableItem(theMenu, 0);
  1101. X        EnableItem(theMenu, 4);
  1102. X        break;
  1103. X
  1104. X    case editMenu:
  1105. X        for(x = 1; x < 7; x++)
  1106. X            DisableItem(theMenu, x);
  1107. X        EnableItem(theMenu, 0);
  1108. X        editMenuH = theMenu;
  1109. X        break;
  1110. X
  1111. X    }
  1112. X}
  1113. X
  1114. X
  1115. Xvoid
  1116. XMoreEnabling(MenuHandle theMenu, int i)
  1117. X{
  1118. Xint x;
  1119. X
  1120. X    switch(i) {
  1121. X
  1122. X    default :
  1123. X        EnableItem(theMenu, 0);
  1124. X        break;
  1125. X
  1126. X    case fileMenu:
  1127. X        for(x = 0; x < 9; x++) if(x != 6 && x != 8)
  1128. X            EnableItem(theMenu, x);
  1129. X        SetItem(theMenu, 9, "\PQuit");
  1130. X        break;
  1131. X
  1132. X    case editMenu:
  1133. X        for(x = 1; x < 7; x++)
  1134. X            EnableItem(theMenu, x);
  1135. X        DisableItem(theMenu, 0);
  1136. X        break;
  1137. X
  1138. X    }
  1139. X}
  1140. X
  1141. X
  1142. Xvoid
  1143. XMoreMenus(void)
  1144. X{
  1145. XMenuHandle theMenu;
  1146. Xint i;
  1147. X
  1148. X    for(i=appleMenu; i <=extendMenu; i++) {
  1149. X        if(theMenu = GetMHandle(i)) {
  1150. X            MoreDisabling(theMenu, i);
  1151. X        }
  1152. X    }
  1153. X    DrawMenuBar();
  1154. X}
  1155. X
  1156. X
  1157. Xvoid
  1158. XLessMenus(void)
  1159. X{
  1160. XMenuHandle theMenu;
  1161. Xint i;
  1162. X
  1163. X    for(i=appleMenu; i <=extendMenu; i++) {
  1164. X        if(theMenu = GetMHandle(i)) {
  1165. X            MoreEnabling(theMenu, i);
  1166. X        }
  1167. X    }    
  1168. X    DrawMenuBar();
  1169. X}
  1170. X
  1171. X
  1172. Xint
  1173. Xmac_more(FILE * fp, int strip)
  1174. X{
  1175. XWindowRecord    MoreWindow;
  1176. Xterm_info        * t;
  1177. XGrafPtr            savedPort;
  1178. X
  1179. X    if(MoofFile(fp, strip)) return -1; /* God knows what happened */
  1180. X
  1181. X    theSelect.start = theSelect.end = theSelect.startline =
  1182. X        theSelect.endline = 0;
  1183. X    oldSelect = theSelect;
  1184. X    MoveHHi(theData);
  1185. X    HLock(theData);
  1186. X    noRs = CountChars(*theData, length, '\r');
  1187. X    lineStarts = (long **) NewHandle((noRs + 1) * sizeof(long));
  1188. X    if(!lineStarts || MemError()) panic("Out of memory");
  1189. X    setLineStarts(lineStarts, *theData, length);
  1190. X    HUnlock(theData);
  1191. X    scrollMax = noRs - Y_SIZE;
  1192. X    if(scrollMax < 0) scrollMax = 0;
  1193. X
  1194. X    GetPort(&savedPort);
  1195. X    t = (term_info *) GetWRefCon(HackWindow);
  1196. X
  1197. X    if(t->inColor ? !GetNewCWindow(301, &MoreWindow, 0L) :
  1198. X        !GetNewWindow(301, &MoreWindow, 0)) {
  1199. X        DisposHandle(theData);
  1200. X        panic("No WIND resource for pager");
  1201. X    } else if(ResError()) {
  1202. X        DisposHandle(theData);
  1203. X        panic("No WIND resource for pager");
  1204. X    } /* And now set the sizes & things */
  1205. X    PagerWindow = (GrafPtr) &MoreWindow;
  1206. X
  1207. X    width = t->charWidth;
  1208. X    height = t->height;
  1209. X    if(inited != t->height) {
  1210. X        SetRect(&windowSize, X_POS, Y_POS, width * X_SIZE + X_BORDER + X_POS,
  1211. X            height * Y_SIZE + Y_BORDER + Y_POS);
  1212. X        inited = t->height;
  1213. X    }    
  1214. X    SizeWindow(PagerWindow, windowSize.right - windowSize.left,
  1215. X        windowSize.bottom - windowSize.top, 0);
  1216. X    MoveWindow(PagerWindow, windowSize.left, windowSize.top, 0);
  1217. X    ShowWindow(PagerWindow);
  1218. X    SelectWindow(PagerWindow);
  1219. X    SetPort(PagerWindow);
  1220. X
  1221. X    text_area = windowSize;
  1222. X    OffsetRect(&text_area, - text_area.left, - text_area.top);
  1223. X    text_area.left = text_area.right - 14;
  1224. X    InsetRect(&text_area, - 1, - 1);
  1225. X    theScrollBar = NewControl(PagerWindow, &text_area,
  1226. X        "\PMore Text", 1, 0, 0, scrollMax, scrollBarProc, 0);
  1227. X    HiliteControl(theScrollBar, scrollMax ? 0 : 254);
  1228. X
  1229. X    SetRect(&text_area, LEFT_MARGIN, TOP_MARGIN, width * X_SIZE + LEFT_MARGIN,
  1230. X        height * Y_SIZE + TOP_MARGIN);
  1231. X    TextFont(t->fontNum);
  1232. X    TextSize(t->fontSize);
  1233. X    TextMode(srcCopy);
  1234. X    textPos = 0;
  1235. X
  1236. X    MoreMenus();
  1237. X    MagicDisplay(t);
  1238. X    LessMenus();
  1239. X
  1240. X    if(theScrollBar) KillControls((WindowPtr) &MoreWindow);
  1241. X    CloseWindow((WindowPtr) &MoreWindow);
  1242. X    DisposHandle(theData);
  1243. X    SetPort(HackWindow);
  1244. X    docrt();
  1245. X    SetPort(savedPort);
  1246. X    return 0;
  1247. X}
  1248. END_OF_FILE
  1249. if test 24474 -ne `wc -c <'mac/MacAlert.c'`; then
  1250.     echo shar: \"'mac/MacAlert.c'\" unpacked with wrong size!
  1251. fi
  1252. # end of 'mac/MacAlert.c'
  1253. echo shar: Extracting \"'others/Makefile.ovl'\" \(24531 characters\)
  1254. sed "s/^X//" >'others/Makefile.ovl' <<'END_OF_FILE'
  1255. X#    SCCS Id: @(#)Makefile.ovl    3.0    90/06/03
  1256. X#    PC NetHack 3.0 Makefile for Microsoft(tm) "C" 5.1 -- Pierre Martineau
  1257. X#    Overlay Arrangement -- Stephen Spackman, Pierre Martineau, Norm Meluch
  1258. X#    Multiple Compilation Hack and so forth -- Stephen Spackman
  1259. X#    Additional editing -- Kevin Smolkowski
  1260. X#
  1261. X#    Other things that have to be reconfigured are in config.h, pcconf.h,
  1262. X#    and possibly system.h.
  1263. X#
  1264. X#    Nota Bene: OVERLAY *must* be defined in pcconf.h to use this makefile!
  1265. X#    Also: Rename this file to "makefile", some targets rely on it.
  1266. X# -----------------------------------------------------------------------------
  1267. X#    In addition to your C compiler,
  1268. X#
  1269. X#    if you want to change        you will need a
  1270. X#    files with suffix        workalike for
  1271. X#           .y                yacc
  1272. X#           .l                lex
  1273. X#           .asm                masm
  1274. X# -----------------------------------------------------------------------------
  1275. X#    As it is set up, this makefile requires that exesmurf (the
  1276. X#    NetHack overlay-aware .exe header editor) be on your path or in the
  1277. X#    $(SRC) directory. If you wish to change the path or use Microsoft
  1278. X#    EXEMOD instead, see the symbols EXEPATCH and EXEFLAGS.
  1279. X#
  1280. X# *****************************************************************************
  1281. X# ************************ Compiler Info **************************************
  1282. X# *****************************************************************************
  1283. XCC     = cl /c
  1284. XLINK     = link
  1285. XMODEL     = L
  1286. XASM     = masm
  1287. XEXEPATCH = exesmurf
  1288. X# $(MAKE) macro is often predefined, so we use $(MAKEBIN) instead.
  1289. XMAKEBIN = make
  1290. X# For those of us who have these on PC.
  1291. X# YACC     = yacc
  1292. X# LEX     = lex
  1293. XYACC    = bison -y
  1294. XLEX    = flex
  1295. X# Standard file names may vary in PC installations.
  1296. XYTABC    = y_tab.c
  1297. XYTABH    = y_tab.h
  1298. XLEXYYC    = lexyy.c
  1299. X# Register bug, remove stack probes...
  1300. X# /Gt22 is currently about the largest value that keeps the initialised data
  1301. X# segment below 64K (and keeps the linker happy).
  1302. X# 286 or higher machines can use the /G2 CFLAG option for better performance.
  1303. XCFLAGS    = /A$(MODEL) /Oa /Gs /Gt22 /Zp1 /W0 /I$(INCL)
  1304. XCOSPACE = /Os
  1305. XCOSPEED = /Os  # MSC 5.1 seems to be broken, or maybe it's the NetHack code.
  1306. X#              # Either way, setting COSPEED to /Ot wreaked jolly flaming havoc.
  1307. X#
  1308. XLFLAGS    = /noi /seg:512 /map /st:4096
  1309. X#
  1310. X# Available assembler flags:
  1311. X#    /Di386    = Use 386 specific enhancements
  1312. X#    /DNOEMS = Do not use EMS memory
  1313. X#    /DDEBUG = Report memory usage on startup
  1314. XAFLAGS    = /MX
  1315. X#
  1316. X###############################################################################
  1317. X# Use the first line if you are using EXESMURF or the second for EXEMOD.
  1318. XEXEFLAGS = /max3000 /min3000
  1319. X# EXEFLAGS = /max BB8 /min BB8
  1320. X###############################################################################
  1321. X#
  1322. X# *****************************************************************************
  1323. X# ********* Directories (makedefs hardcodes these, don't change them) *********
  1324. X# *****************************************************************************
  1325. X#
  1326. XINCL    = ..\include
  1327. XAUX    = ..\auxil
  1328. XSRC    = ..\src
  1329. XOTHERS    = ..\others
  1330. XOBJ    = $(SRC)\o
  1331. X#
  1332. X# *****************************************************************************
  1333. X# ************************ Local Variables ************************************
  1334. X# *****************************************************************************
  1335. X#
  1336. X# The game name
  1337. XGAME     = NetHack
  1338. X#
  1339. X# The default make target (so just typing 'make' is useful)
  1340. XDEFAULT  : $(GAME)
  1341. X#
  1342. X# The game directory
  1343. X# make sure GAMEDIR exists!
  1344. XGAMEDIR  = ..
  1345. X#
  1346. X# The game filename
  1347. XGAMEFILE = $(GAMEDIR)\$(GAME).exe
  1348. X#
  1349. X# Target environment prefix
  1350. XTARG     = pc
  1351. X#
  1352. X# Overlay manager object file.
  1353. XOVLMGR     = ovlmgr.obj
  1354. X#
  1355. X# Termcap routines.
  1356. XTERMCAPS = $(SRC)\termlib.lib
  1357. X#
  1358. X###############################################################################
  1359. X# Switch the following lines if you have a MASM compatible assembler.
  1360. X# $(OBJ)\$(OVLMGR):
  1361. X$(OBJ)\$(OVLMGR): ; copy $(OTHERS)\$(OVLMGR) $(OBJ)\$(OVLMGR)
  1362. X###############################################################################
  1363. X# If you have yacc and lex programs and make any changes, comment out the
  1364. X# upper two targets and uncomment the lower two.
  1365. Xdo_yacc: yacc_msg
  1366. Xdo_lex:  lex_msg
  1367. X# do_yacc: yacc_act
  1368. X# do_lex:  lex_act
  1369. X###############################################################################
  1370. X# Optional high-quality BSD random number generation routines (see pcconf.h).
  1371. X# Set to nothing if not used.
  1372. XRANDOM     = $(OBJ)\random.o
  1373. X# RANDOM =
  1374. X###############################################################################
  1375. X# Optional C library specifier for those with non-standard libraries or
  1376. X# a multiple-target library setup.
  1377. X# CLIB       = llibcer /nod
  1378. XCLIB     =
  1379. X###############################################################################
  1380. X# If TERMLIB is NOT #defined in the source, comment out the lower line and
  1381. X# uncomment the upper. Don't forget to copy the $(TERMCAPS) file to the
  1382. X# $(SRC) directory if you have uncommented the lower line.
  1383. X# TERMLIB  =
  1384. XTERMLIB  = $(TERMCAPS)
  1385. X###############################################################################
  1386. X#
  1387. X# nothing below this line should have to be changed
  1388. X
  1389. XROOT =  $(OBJ)\$(OVLMGR) $(OBJ)\trampoli.o $(OBJ)\main.o $(OBJ)\msdos.o \
  1390. X    $(OBJ)\alloc.o $(OBJ)\random.o $(OBJ)\decl.o $(OBJ)\monst.o \
  1391. X    $(OBJ)\objects.o $(OBJ)\invent.0 $(OBJ)\mkobj.0 $(OBJ)\mkroom.0 \
  1392. X    $(OBJ)\rnd.0 $(OBJ)\termcap.0
  1393. X# main monster code
  1394. XOVL01 = $(OBJ)\cmd.0 $(OBJ)\dbridge.0 $(OBJ)\dog.0 $(OBJ)\engrave.0-1 \
  1395. X    $(OBJ)\hack.0 $(OBJ)\mon.0-1 $(OBJ)\mondata.0-1 $(OBJ)\monmove.0-1 \
  1396. X    $(OBJ)\mthrowu.0 $(OBJ)\priest.0 $(OBJ)\shk.0 $(OBJ)\track.0 \
  1397. X    $(OBJ)\trap.0-1 $(OBJ)\were.0
  1398. X# pet code
  1399. XOVL02 = $(OBJ)\apply.0 $(OBJ)\dog.1 $(OBJ)\dogmove.o
  1400. X# advanced monsters
  1401. XOVL03 = $(OBJ)\demon.o $(OBJ)\mcastu.o
  1402. XOVL04 = $(OBJ)\priest.1-b
  1403. XOVL05 = $(OBJ)\shk.1-b
  1404. XOVL06 = $(OBJ)\were.1-b
  1405. XOVL07 = $(OBJ)\wizard.1-b
  1406. XOVL08 = $(OBJ)\worm.o
  1407. X# main people things: you take your turn
  1408. XOVL09 = $(OBJ)\allmain.0 $(OBJ)\artifact.0 $(OBJ)\attrib.1 $(OBJ)\cmd.1 \
  1409. X    $(OBJ)\do.1 $(OBJ)\do.3 $(OBJ)\eat.0 $(OBJ)\engrave.2 \
  1410. X    $(OBJ)\getline.0-1 $(OBJ)\hack.1 $(OBJ)\lock.0 $(OBJ)\mail.0 \
  1411. X    $(OBJ)\pickup.1 $(OBJ)\pri.1 $(OBJ)\prisym.1 $(OBJ)\sounds.0 \
  1412. X    $(OBJ)\timeout.0 $(OBJ)\track.1 $(OBJ)\vault.0 $(OBJ)\wizard.0
  1413. XOVL10 = $(OBJ)\attrib.0
  1414. XOVL11 = $(OBJ)\attrib.2-b $(OBJ)\exper.o
  1415. XOVL12 = $(OBJ)\artifact.2 $(OBJ)\eat.1 $(OBJ)\invent.1
  1416. XOVL13 = $(OBJ)\makemon.0-2 $(OBJ)\mkobj.1
  1417. XOVL14 = $(OBJ)\makemon.b
  1418. XOVL15 = $(OBJ)\mkobj.2-b
  1419. XOVL16 = $(OBJ)\hack.2
  1420. XOVL17 = $(OBJ)\mhitm.1-b
  1421. XOVL18 = $(OBJ)\mthrowu.1
  1422. XOVL19 = $(OBJ)\mthrowu.2-b
  1423. XOVL20 = $(OBJ)\allmain.1 $(OBJ)\mhitm.0 $(OBJ)\mhitu.0-1 $(OBJ)\rnd.1 \
  1424. X    $(OBJ)\weapon.0-1
  1425. XOVL21 = $(OBJ)\mon.2-b $(OBJ)\trap.2
  1426. XOVL22 = $(OBJ)\artifact.1 $(OBJ)\search.0 $(OBJ)\uhitm.o $(OBJ)\weapon.2-b
  1427. XOVL23 = $(OBJ)\do_wear.0-1 $(OBJ)\mhitu.2-b
  1428. XOVL24 = $(OBJ)\steal.0-1
  1429. XOVL25 = $(OBJ)\monmove.2-b $(OBJ)\steal.2-b
  1430. XOVL26 = $(OBJ)\rnd.2-b
  1431. XOVL27 = $(OBJ)\do_wear.2 $(OBJ)\getline.b $(OBJ)\mondata.2 $(OBJ)\objnam.0-1 \
  1432. X    $(OBJ)\pager.0 $(OBJ)\polyself.0-1
  1433. XOVL28 = $(OBJ)\do_name.0
  1434. XOVL29 = $(OBJ)\objnam.2-b
  1435. XOVL30 = $(OBJ)\pager.1-b
  1436. XOVL31 = $(OBJ)\pri.0 $(OBJ)\prisym.0 $(OBJ)\topl.0
  1437. XOVL32 = $(OBJ)\pri.b $(OBJ)\topl.1-2
  1438. XOVL33 = $(OBJ)\prisym.2
  1439. XOVL34 = $(OBJ)\prisym.b
  1440. XOVL35 = $(OBJ)\topl.b
  1441. XOVL36 = $(OBJ)\termcap.1 $(OBJ)\unix.0
  1442. XOVL37 = $(OBJ)\termcap.2-b
  1443. XOVL38 = $(OBJ)\dog.b $(OBJ)\sounds.1-b
  1444. XOVL39 = $(OBJ)\read.0
  1445. XOVL40 = $(OBJ)\invent.b
  1446. XOVL41 = $(OBJ)\hack.b
  1447. XOVL42 = $(OBJ)\mondata.b $(OBJ)\timeout.1-b
  1448. XOVL43 = $(OBJ)\do.0 $(OBJ)\invent.3
  1449. XOVL44 = $(OBJ)\cmd.2-b $(OBJ)\getline.2 $(OBJ)\write.o
  1450. XOVL45 = $(OBJ)\apply.2-b
  1451. XOVL46 = $(OBJ)\do.b
  1452. XOVL47 = $(OBJ)\dokick.o
  1453. XOVL48 = $(OBJ)\dothrow.o
  1454. XOVL49 = $(OBJ)\eat.2-b
  1455. XOVL50 = $(OBJ)\invent.2 $(OBJ)\pickup.0 $(OBJ)\pickup.2-b
  1456. XOVL51 = $(OBJ)\lock.1-b
  1457. XOVL52 = $(OBJ)\polyself.2-b
  1458. XOVL53 = $(OBJ)\potion.o
  1459. XOVL54 = $(OBJ)\pray.o
  1460. XOVL55 = $(OBJ)\read.1-b $(OBJ)\spell.o
  1461. XOVL56 = $(OBJ)\search.1-b
  1462. X# clothing stuff
  1463. XOVL57 = $(OBJ)\do_wear.b $(OBJ)\wield.o $(OBJ)\worn.o
  1464. X# Zappage
  1465. XOVL58 = $(OBJ)\pri.2 $(OBJ)\zap.o
  1466. XOVL59 = $(OBJ)\dbridge.1-b
  1467. XOVL60 = $(OBJ)\trap.b
  1468. X# Unusual circumstances
  1469. XOVL61 = $(OBJ)\artifact.b $(OBJ)\do_name.1-b $(OBJ)\fountain.o $(OBJ)\music.o \
  1470. X    $(OBJ)\rumors.o $(OBJ)\shknam.0 $(OBJ)\sit.o $(OBJ)\vault.1-b
  1471. X# Uppers and Downers
  1472. X# Note: version.o is in OVL62, but in a special way.  See below.
  1473. XOVL62 = $(OBJ)\allmain.2-b $(OBJ)\end.o $(OBJ)\engrave.b $(OBJ)\mail.1-b \
  1474. X    $(OBJ)\o_init.o $(OBJ)\options.o $(OBJ)\restore.o $(OBJ)\rip.o \
  1475. X    $(OBJ)\save.o $(OBJ)\shknam.1-b $(OBJ)\topten.o $(OBJ)\tty.o \
  1476. X    $(OBJ)\u_init.o $(OBJ)\unix.1-b
  1477. X# Levelling
  1478. XOVL63 = $(OBJ)\apply.1 $(OBJ)\bones.o $(OBJ)\do.2 $(OBJ)\dog.2 \
  1479. X    $(OBJ)\extralev.o $(OBJ)\mklev.o $(OBJ)\mkmaze.o $(OBJ)\mkroom.1-b \
  1480. X    $(OBJ)\sp_lev.o $(OBJ)\track.2-b
  1481. X
  1482. X
  1483. X# *****************************************************************************
  1484. X# ************************* Make Objects **************************************
  1485. X# *****************************************************************************
  1486. X
  1487. XMOBJ = $(OVL01) $(OVL02) $(OVL03) $(OVL04) $(OVL05) $(OVL06) $(OVL07) $(OVL08)\
  1488. X       $(OVL09) $(OVL10) $(OVL11) $(OVL12) $(OVL13) $(OVL14) $(OVL15) $(OVL16)\
  1489. X       $(OVL17) $(OVL18) $(OVL19) $(OVL20) $(OVL21) $(OVL22) $(OVL23) $(OVL24)\
  1490. X       $(OVL25) $(OVL26) $(OVL27) $(OVL28) $(OVL29) $(OVL30) $(OVL31) $(OVL32)\
  1491. X       $(OVL33) $(OVL34) $(OVL35) $(OVL36) $(OVL37) $(OVL38) $(OVL39) $(OVL40)\
  1492. X       $(OVL41) $(OVL42) $(OVL43) $(OVL44) $(OVL45) $(OVL46) $(OVL47) $(OVL48)\
  1493. X       $(OVL49) $(OVL50) $(OVL51) $(OVL52) $(OVL53) $(OVL54) $(OVL55) $(OVL56)\
  1494. X       $(OVL57) $(OVL58) $(OVL59) $(OVL60) $(OVL61) $(OVL62) $(OVL63)
  1495. X
  1496. XVOBJ =    $(ROOT) $(MOBJ)
  1497. X
  1498. XHOBJ =    $(VOBJ) $(OBJ)\version.o
  1499. X
  1500. X# object files for makedefs
  1501. XMAKEOBJS    =    $(OBJ)\makedefs.o $(OBJ)\alloc.o    $(OBJ)\monst.o    \
  1502. X        $(OBJ)\objects.o  $(OBJ)\panic.o
  1503. X
  1504. XOVERLAYS = ($(OVL01)) ($(OVL02)) ($(OVL03)) ($(OVL04)) ($(OVL05)) ($(OVL06)) \
  1505. X       ($(OVL07)) ($(OVL08)) ($(OVL09)) ($(OVL10)) ($(OVL11)) ($(OVL12)) \
  1506. X       ($(OVL13)) ($(OVL14)) ($(OVL15)) ($(OVL16)) ($(OVL17)) ($(OVL18)) \
  1507. X       ($(OVL19)) ($(OVL20)) ($(OVL21)) ($(OVL22)) ($(OVL23)) ($(OVL24)) \
  1508. X       ($(OVL25)) ($(OVL26)) ($(OVL27)) ($(OVL28)) ($(OVL29)) ($(OVL30)) \
  1509. X       ($(OVL31)) ($(OVL32)) ($(OVL33)) ($(OVL34)) ($(OVL35)) ($(OVL36)) \
  1510. X       ($(OVL37)) ($(OVL38)) ($(OVL39)) ($(OVL40)) ($(OVL41)) ($(OVL42)) \
  1511. X       ($(OVL43)) ($(OVL44)) ($(OVL45)) ($(OVL46)) ($(OVL47)) ($(OVL48)) \
  1512. X       ($(OVL49)) ($(OVL50)) ($(OVL51)) ($(OVL52)) ($(OVL53)) ($(OVL54)) \
  1513. X       ($(OVL55)) ($(OVL56)) ($(OVL57)) ($(OVL58)) ($(OVL59)) ($(OVL60)) \
  1514. X       ($(OVL61)) ($(OVL62)      $(OBJ)\version.o) ($(OVL63))
  1515. X
  1516. X# object files for special levels compiler
  1517. XSPLEVOBJS   =    $(OBJ)\lev_comp.o $(OBJ)\lev_lex.o  $(OBJ)\lev_main.o \
  1518. X        $(OBJ)\alloc.o      $(OBJ)\monst.o    $(OBJ)\objects.o  \
  1519. X        $(OBJ)\panic.o
  1520. X
  1521. X# *****************************************************************************
  1522. X# ************************** Header Objects ***********************************
  1523. X# *****************************************************************************
  1524. X
  1525. XPCCONF_H   = $(INCL)\$(TARG)conf.h $(INCL)\msdos.h    $(INCL)\system.h
  1526. XGLOBAL_H   = $(PCCONF_H)       $(INCL)\coord.h    $(INCL)\global.h
  1527. XCONFIG_H   = $(GLOBAL_H)       $(INCL)\config.h   $(INCL)\tradstdc.h
  1528. XPERMONST_H = $(INCL)\permonst.h    $(INCL)\monattk.h  $(INCL)\monflag.h
  1529. XYOUPROP_H  = $(PERMONST_H)       $(INCL)\prop.h     $(INCL)\mondata.h \
  1530. X         $(INCL)\pm.h       $(INCL)\youprop.h
  1531. XYOU_H       = $(YOUPROP_H)       $(INCL)\attrib.h   $(INCL)\monst.h \
  1532. X         $(INCL)\you.h
  1533. XDECL_H       = $(YOU_H)           $(INCL)\decl.h     $(INCL)\obj.h \
  1534. X         $(INCL)\onames.h       $(INCL)\spell.h    $(INCL)\color.h
  1535. XHACK_H       = $(CONFIG_H)       $(DECL_H)          $(INCL)\trap.h \
  1536. X         $(INCL)\flag.h       $(INCL)\gold.h     $(INCL)\mkroom.h \
  1537. X         $(INCL)\monsym.h       $(INCL)\objclass.h $(INCL)\rm.h \
  1538. X         $(INCL)\trampoli.h    $(INCL)\hack.h
  1539. X
  1540. X# *****************************************************************************
  1541. X# ************************ File Dependencies **********************************
  1542. X# *****************************************************************************
  1543. X
  1544. X# Due to an NDMake inadequacy these must accord with a topological sort of the
  1545. X# generated-from relation... output on the left, input on the right. Trust me.
  1546. X.SUFFIXES:  .exe .0 .0-1 .0-2 .0-3 .1 .1-2 .1-3 .1-b .2 .2-3 .2-b .3 .3-b .b \
  1547. X        .o .c .y .l .obj .asm
  1548. X
  1549. X.c.o:
  1550. X    $(CC) $(CFLAGS) $(COSPACE) /Fo$(OBJ)\$*.o $*.c
  1551. X.c.0:
  1552. X    $(CC) $(CFLAGS) $(COSPEED) /DOVL0 /NT$*.0 /Fo$(OBJ)\$*.0 $*.c
  1553. X.c.0-1:
  1554. X    $(CC) $(CFLAGS) $(COSPEED) /DOVL0 /DOVL1 /NT$*.0-1 /Fo$(OBJ)\$*.0-1 $*.c
  1555. X.c.0-2:
  1556. X    $(CC) $(CFLAGS) $(COSPACE) /DOVL0 /DOVL1 /DOVL2 /NT$*.0-2 /Fo$(OBJ)\$*.0-2 $*.c
  1557. X.c.0-3:
  1558. X    $(CC) $(CFLAGS) $(COSPACE) /DOVL0 /DOVL1 /DOVL2 /DOVL3 /NT$*.0-3 /Fo$(OBJ)\$*.0-3 $*.c
  1559. X.c.1:
  1560. X    $(CC) $(CFLAGS) $(COSPACE) /DOVL1 /NT$*.1 /Fo$(OBJ)\$*.1 $*.c
  1561. X.c.1-2:
  1562. X    $(CC) $(CFLAGS) $(COSPACE) /DOVL1 /DOVL2 /NT$*.1-2 /Fo$(OBJ)\$*.1-2 $*.c
  1563. X.c.1-3:
  1564. X    $(CC) $(CFLAGS) $(COSPACE) /DOVL1 /DOVL2 /DOVL3 /NT$*.1-3 /Fo$(OBJ)\$*.1-3 $*.c
  1565. X.c.1-b:
  1566. X    $(CC) $(CFLAGS) $(COSPACE) /DOVL1 /DOVL2 /DOVL3 /DOVLB /NT$*.1-b /Fo$(OBJ)\$*.1-b $*.c
  1567. X.c.2:
  1568. X    $(CC) $(CFLAGS) $(COSPACE) /DOVL2 /NT$*.2 /Fo$(OBJ)\$*.2 $*.c
  1569. X.c.2-3:
  1570. X    $(CC) $(CFLAGS) $(COSPACE) /DOVL2 /DOVL3 /NT$*.2-3 /Fo$(OBJ)\$*.2-3 $*.c
  1571. X.c.2-b:
  1572. X    $(CC) $(CFLAGS) $(COSPACE) /DOVL2 /DOVL3 /DOVLB /NT$*.2-b /Fo$(OBJ)\$*.2-b $*.c
  1573. X.c.3:
  1574. X    $(CC) $(CFLAGS) $(COSPACE) /DOVL3 /NT$*.3 /Fo$(OBJ)\$*.3 $*.c
  1575. X.c.3-b:
  1576. X    $(CC) $(CFLAGS) $(COSPACE) /DOVL3 /DOVLB /NT$*.3-b /Fo$(OBJ)\$*.3-b $*.c
  1577. X.c.b:
  1578. X    $(CC) $(CFLAGS) $(COSPACE) /DOVLB /NT$*.b /Fo$(OBJ)\$*.b $*.c
  1579. X.asm.obj:
  1580. X    $(ASM) $(AFLAGS) $*.asm,$(OBJ)\$*.obj ;
  1581. X
  1582. X$(GAME): $(GAMEFILE)
  1583. X
  1584. X$(GAME).exe: $(GAMEFILE)
  1585. X
  1586. X$(GAMEFILE): $(OBJ) $(HOBJ)
  1587. X    @echo Loading....
  1588. X    $(LINK) $(ROOT) $(OVERLAYS),$(GAMEFILE),$(GAME),$(CLIB) $(TERMLIB) $(LFLAGS) ;
  1589. X    $(EXEPATCH) $(GAMEFILE) $(EXEFLAGS)
  1590. X    @echo NetHack is up to date.
  1591. X
  1592. X$(OBJ):
  1593. X    if not exist .\$(OBJ)\*.* mkdir $(OBJ)
  1594. X
  1595. X#    The following 3 modules vary depending on what OS you are using.
  1596. X
  1597. X$(OBJ)\main.o:    $(HACK_H) $(TARG)main.c
  1598. X    $(CC) $(CFLAGS) $(COSPACE)  /Fo.\$(OBJ)\main.o $(TARG)main.c
  1599. X
  1600. X$(OBJ)\tty.o:    $(HACK_H) $(INCL)\func_tab.h $(TARG)tty.c
  1601. X    $(CC) $(CFLAGS) $(COSPACE)  /Fo.\$(OBJ)\tty.o  $(TARG)tty.c
  1602. X
  1603. X$(OBJ)\unix.0:    $(HACK_H) $(TARG)unix.c
  1604. X    $(CC) $(CFLAGS) $(COSPEED)  /DOVL0 /Fo.\$(OBJ)\unix.0 $(TARG)unix.c
  1605. X$(OBJ)\unix.1-b:    $(HACK_H) $(TARG)unix.c
  1606. X    $(CC) $(CFLAGS) $(COSPACE)  /DOVL1 /DOVL2 /DOVL3 /DOVLB /Fo.\$(OBJ)\unix.1-b $(TARG)unix.c
  1607. X
  1608. X$(OBJ)\makedefs.o:    $(INCL)\config.h $(INCL)\permonst.h $(INCL)\objclass.h
  1609. X
  1610. Xmakedefs.exe:    $(MAKEOBJS)
  1611. X    $(LINK) $(LFLAGS) $(MAKEOBJS), makedefs.exe,, $(CLIB);
  1612. X
  1613. X#    Targets for the special levels compiler
  1614. X
  1615. Xlev_comp.c: lev_comp.y
  1616. X    $(MAKEBIN) do_yacc
  1617. X
  1618. Xlev_lex.c:  lev_comp.l
  1619. X    $(MAKEBIN) do_lex
  1620. X
  1621. Xyacc_msg:
  1622. X    @echo lev_comp.y has changed. To update lev_comp.c and lev_comp.h run YACC.
  1623. X
  1624. Xyacc_act:
  1625. X    $(YACC) -d lev_comp.y
  1626. X    copy $(YTABC) lev_comp.c
  1627. X    copy $(YTABH) $(INCL)\lev_comp.h
  1628. X    del $(YTABC)
  1629. X    del $(YTABH)
  1630. X
  1631. Xlex_msg:
  1632. X    @echo lev_comp.l has changed. To update lev_lex.c run LEX.
  1633. X
  1634. Xlex_act:
  1635. X    $(LEX) lev_comp.l
  1636. X    copy $(LEXYYC) lev_lex.c
  1637. X    del $(LEXYYC)
  1638. X
  1639. X#    This is stupid but since the default rule does not work here ...
  1640. X
  1641. X$(OBJ)\lev_comp.o:    $(HACK_H)   $(INCL)\sp_lev.h    lev_comp.c
  1642. X    $(CC) $(CFLAGS) /Fo$(OBJ)\$*.o $*.c
  1643. X$(OBJ)\lev_lex.o:    $(HACK_H)   $(INCL)\sp_lev.h    $(INCL)\lev_comp.h \
  1644. X            lev_lex.c
  1645. X    $(CC) $(CFLAGS) /Fo$(OBJ)\$*.o $*.c
  1646. X
  1647. Xlev_comp.exe:    $(SPLEVOBJS)
  1648. X    $(LINK) $(LFLAGS) $(SPLEVOBJS),lev_comp.exe,, $(CLIB);
  1649. X
  1650. X# *****************************************************************************
  1651. X# *************************  Makedefs Stuff ***********************************
  1652. X# *****************************************************************************
  1653. X#    The following include files depend on makedefs to be created.
  1654. X#    date.h should be remade any time any of the source or include code
  1655. X#    is modified.
  1656. X
  1657. X$(INCL)\date.h: $(VOBJ) makedefs.exe
  1658. X    .\makedefs -v
  1659. X
  1660. X$(INCL)\onames.h: makedefs.exe
  1661. X    .\makedefs -o
  1662. X
  1663. X$(INCL)\pm.h: makedefs.exe
  1664. X    .\makedefs -p
  1665. X
  1666. X$(INCL)\trap.h: makedefs.exe
  1667. X    .\makedefs -t
  1668. X
  1669. Xdata:    $(AUX)\data.bas makedefs.exe
  1670. X    .\makedefs -d
  1671. X
  1672. Xrumors: $(AUX)\rumors.tru $(AUX)\rumors.fal makedefs.exe
  1673. X    .\makedefs -r
  1674. X
  1675. X# *****************************************************************************
  1676. X# ************************ Secondary targets **********************************
  1677. X# *****************************************************************************
  1678. X
  1679. Xall:    install
  1680. X
  1681. Xinstall:    $(OBJ) lev_comp.exe $(GAMEFILE) auxil.tag install.tag
  1682. X    @echo Don't forget to check HACKDIR in NetHack.cnf.
  1683. X    @echo Done.
  1684. X
  1685. Xinstall.tag:
  1686. X    copy $(OTHERS)\termcap        $(GAMEDIR)
  1687. X    copy $(AUX)\*.            $(GAMEDIR)
  1688. X    del  $(GAMEDIR)\MacHelp
  1689. X    copy $(OTHERS)\NetHack.cnf    $(GAMEDIR)
  1690. X    echo install done > install.tag
  1691. X
  1692. Xspec_lev.tag: lev_comp.exe $(AUX)\castle.des $(AUX)\endgame.des $(AUX)\tower.des
  1693. X    lev_comp $(AUX)\castle.des
  1694. X    lev_comp $(AUX)\endgame.des
  1695. X    lev_comp $(AUX)\tower.des
  1696. X    copy castle $(GAMEDIR)
  1697. X    copy endgame $(GAMEDIR)
  1698. X    copy tower? $(GAMEDIR)
  1699. X    del castle
  1700. X    del endgame
  1701. X    del tower?
  1702. X    echo spec_lev done > spec_lev.tag
  1703. X
  1704. Xauxil.tag:    spec_lev.tag    data    rumors
  1705. X    echo special levels created > auxil.tag
  1706. X
  1707. Xclean:
  1708. X    del $(OBJ)\*.o
  1709. X    del $(OBJ)\*.0
  1710. X    del $(OBJ)\*.0-1
  1711. X    del $(OBJ)\*.0-2
  1712. X    del $(OBJ)\*.0-3
  1713. X    del $(OBJ)\*.1
  1714. X    del $(OBJ)\*.1-2
  1715. X    del $(OBJ)\*.1-3
  1716. X    del $(OBJ)\*.1-b
  1717. X    del $(OBJ)\*.2
  1718. X    del $(OBJ)\*.2-3
  1719. X    del $(OBJ)\*.2-b
  1720. X    del $(OBJ)\*.3
  1721. X    del $(OBJ)\*.3-b
  1722. X    del $(OBJ)\*.b
  1723. X    del $(OBJ)\*.obj
  1724. X    rmdir $(OBJ)
  1725. X
  1726. Xspotless: clean
  1727. X    del $(INCL)\date.h
  1728. X    del $(INCL)\onames.h
  1729. X    del $(INCL)\pm.h
  1730. X    if exist makedefs.exe del makedefs.exe
  1731. X    if exist lev_comp.exe del lev_comp.exe
  1732. X    del castle
  1733. X    del endgame
  1734. X    del tower?
  1735. X    del *.bak
  1736. X    del *.tag
  1737. X    del *.map
  1738. X    del *.obj
  1739. X    del *.lib
  1740. X    del *.txt
  1741. X    del $(AUX)\data
  1742. X    del $(AUX)\rumors
  1743. X
  1744. X# *****************************************************************************
  1745. X# ************************* Other dependencies ********************************
  1746. X# *****************************************************************************
  1747. X# Other dependencies
  1748. X#
  1749. X# I deleted that line.    ;-}
  1750. X
  1751. X$(OBJ)\allmain.0:    $(HACK_H)
  1752. X$(OBJ)\allmain.1:    $(HACK_H)
  1753. X$(OBJ)\allmain.2-b:    $(HACK_H)
  1754. X$(OBJ)\alloc.o:     $(CONFIG_H)
  1755. X$(OBJ)\apply.0:     $(HACK_H)   $(INCL)\edog.h
  1756. X$(OBJ)\apply.1:     $(HACK_H)   $(INCL)\edog.h
  1757. X$(OBJ)\apply.2-b:    $(HACK_H)   $(INCL)\edog.h
  1758. X$(OBJ)\artifact.0:    $(HACK_H)   $(INCL)\artifact.h
  1759. X$(OBJ)\artifact.1:    $(HACK_H)   $(INCL)\artifact.h
  1760. X$(OBJ)\artifact.2:    $(HACK_H)   $(INCL)\artifact.h
  1761. X$(OBJ)\artifact.b:    $(HACK_H)   $(INCL)\artifact.h
  1762. X$(OBJ)\attrib.0:    $(HACK_H)
  1763. X$(OBJ)\attrib.1:    $(HACK_H)
  1764. X$(OBJ)\attrib.2-b:    $(HACK_H)
  1765. X$(OBJ)\bones.o:     $(HACK_H)
  1766. X$(OBJ)\cmd.0:        $(HACK_H)   $(INCL)\func_tab.h
  1767. X$(OBJ)\cmd.1:        $(HACK_H)   $(INCL)\func_tab.h
  1768. X$(OBJ)\cmd.2-b:     $(HACK_H)   $(INCL)\func_tab.h
  1769. X$(OBJ)\dbridge.0:    $(HACK_H)
  1770. X$(OBJ)\dbridge.1-b:    $(HACK_H)
  1771. X$(OBJ)\decl.o:        $(HACK_H)
  1772. X$(OBJ)\demon.o:     $(HACK_H)
  1773. X$(OBJ)\do.0:        $(HACK_H)
  1774. X$(OBJ)\do.1:        $(HACK_H)
  1775. X$(OBJ)\do.2:        $(HACK_H)
  1776. X$(OBJ)\do.3:        $(HACK_H)
  1777. X$(OBJ)\do.b:        $(HACK_H)
  1778. X$(OBJ)\do_name.0:    $(HACK_H)
  1779. X$(OBJ)\do_name.1-b:    $(HACK_H)
  1780. X$(OBJ)\do_wear.0-1:    $(HACK_H)
  1781. X$(OBJ)\do_wear.2:    $(HACK_H)
  1782. X$(OBJ)\do_wear.b:    $(HACK_H)
  1783. X$(OBJ)\dog.0:        $(HACK_H)   $(INCL)\edog.h
  1784. X$(OBJ)\dog.1:        $(HACK_H)   $(INCL)\edog.h
  1785. X$(OBJ)\dog.2:        $(HACK_H)   $(INCL)\edog.h
  1786. X$(OBJ)\dog.b:        $(HACK_H)   $(INCL)\edog.h
  1787. X$(OBJ)\dogmove.o:    $(HACK_H)   $(INCL)\mfndpos.h     $(INCL)\edog.h
  1788. X$(OBJ)\dokick.o:    $(HACK_H)   $(INCL)\eshk.h
  1789. X$(OBJ)\dothrow.o:    $(HACK_H)
  1790. X$(OBJ)\eat.0:        $(HACK_H)
  1791. X$(OBJ)\eat.1:        $(HACK_H)
  1792. X$(OBJ)\eat.2-b:     $(HACK_H)
  1793. X$(OBJ)\end.o:        $(HACK_H)   $(INCL)\eshk.h
  1794. X$(OBJ)\engrave.0-1:    $(HACK_H)
  1795. X$(OBJ)\engrave.2:    $(HACK_H)
  1796. X$(OBJ)\engrave.b:    $(HACK_H)
  1797. X$(OBJ)\exper.o:     $(HACK_H)
  1798. X$(OBJ)\extralev.o:    $(HACK_H)
  1799. X$(OBJ)\fountain.o:    $(HACK_H)
  1800. X$(OBJ)\getline.0-1:    $(HACK_H)   $(INCL)\func_tab.h
  1801. X$(OBJ)\getline.2:    $(HACK_H)   $(INCL)\func_tab.h
  1802. X$(OBJ)\getline.b:    $(HACK_H)   $(INCL)\func_tab.h
  1803. X$(OBJ)\hack.0:        $(HACK_H)
  1804. X$(OBJ)\hack.1:        $(HACK_H)
  1805. X$(OBJ)\hack.2:        $(HACK_H)
  1806. X$(OBJ)\hack.b:        $(HACK_H)
  1807. X$(OBJ)\invent.0:    $(HACK_H)   $(INCL)\lev.h     $(INCL)\wseg.h
  1808. X$(OBJ)\invent.1:    $(HACK_H)   $(INCL)\lev.h     $(INCL)\wseg.h
  1809. X$(OBJ)\invent.2:    $(HACK_H)   $(INCL)\lev.h     $(INCL)\wseg.h
  1810. X$(OBJ)\invent.3:    $(HACK_H)   $(INCL)\lev.h     $(INCL)\wseg.h
  1811. X$(OBJ)\invent.b:    $(HACK_H)   $(INCL)\lev.h     $(INCL)\wseg.h
  1812. X$(OBJ)\ioctl.o:     $(HACK_H)
  1813. X$(OBJ)\lev_main.o:    $(HACK_H)   $(INCL)\sp_lev.h
  1814. X$(OBJ)\lock.0:        $(HACK_H)
  1815. X$(OBJ)\lock.1-b:    $(HACK_H)
  1816. X$(OBJ)\mail.0:        $(HACK_H)
  1817. X$(OBJ)\mail.1-b:    $(HACK_H)
  1818. X$(OBJ)\makemon.0-2:    $(HACK_H)
  1819. X$(OBJ)\makemon.b:    $(HACK_H)
  1820. X$(OBJ)\mcastu.o:    $(HACK_H)
  1821. X$(OBJ)\mhitm.0:     $(HACK_H)   $(INCL)\artifact.h
  1822. X$(OBJ)\mhitm.1-b:    $(HACK_H)   $(INCL)\artifact.h
  1823. X$(OBJ)\mhitu.0-1:    $(HACK_H)   $(INCL)\artifact.h     $(INCL)\edog.h
  1824. X$(OBJ)\mhitu.2-b:    $(HACK_H)   $(INCL)\artifact.h     $(INCL)\edog.h
  1825. X$(OBJ)\mklev.o:     $(HACK_H)
  1826. X$(OBJ)\mkmaze.o:    $(HACK_H)
  1827. X$(OBJ)\mkobj.0:     $(HACK_H)
  1828. X$(OBJ)\mkobj.1:     $(HACK_H)
  1829. X$(OBJ)\mkobj.2-b:    $(HACK_H)
  1830. X$(OBJ)\mkroom.0:    $(HACK_H)
  1831. X$(OBJ)\mkroom.1-b:    $(HACK_H)
  1832. X$(OBJ)\mon.0-1:     $(HACK_H)   $(INCL)\mfndpos.h     $(INCL)\wseg.h
  1833. X$(OBJ)\mon.2-b:     $(HACK_H)   $(INCL)\mfndpos.h     $(INCL)\wseg.h
  1834. X$(OBJ)\mondata.0-1:    $(HACK_H)   $(INCL)\eshk.h     $(INCL)\epri.h
  1835. X$(OBJ)\mondata.2:    $(HACK_H)   $(INCL)\eshk.h     $(INCL)\epri.h
  1836. X$(OBJ)\mondata.b:    $(HACK_H)   $(INCL)\eshk.h     $(INCL)\epri.h
  1837. X$(OBJ)\monmove.0-1:    $(HACK_H)   $(INCL)\mfndpos.h     $(INCL)\artifact.h
  1838. X$(OBJ)\monmove.2-b:    $(HACK_H)   $(INCL)\mfndpos.h     $(INCL)\artifact.h
  1839. X$(OBJ)\monst.o:     $(CONFIG_H) $(PERMONST_H)     $(INCL)\eshk.h \
  1840. X            $(INCL)\vault.h $(INCL)\epri.h     $(INCL)\color.h
  1841. X$(OBJ)\msdos.o:     $(HACK_H)
  1842. X$(OBJ)\mthrowu.0:    $(HACK_H)
  1843. X$(OBJ)\mthrowu.1:    $(HACK_H)
  1844. X$(OBJ)\mthrowu.2-b:    $(HACK_H)
  1845. X$(OBJ)\music.o:     $(HACK_H)
  1846. X$(OBJ)\o_init.o:    $(HACK_H)
  1847. X$(OBJ)\objects.o:    $(CONFIG_H) $(INCL)\obj.h     $(INCL)\objclass.h \
  1848. X            $(INCL)\prop.h    $(INCL)\color.h
  1849. X$(OBJ)\objnam.0-1:    $(HACK_H)
  1850. X$(OBJ)\objnam.2-b:    $(HACK_H)
  1851. X$(OBJ)\options.o:    $(HACK_H)
  1852. X$(OBJ)\pager.0:     $(HACK_H)
  1853. X$(OBJ)\pager.1-b:    $(HACK_H)
  1854. X$(OBJ)\panic.o:     $(CONFIG_H)
  1855. X$(OBJ)\pickup.0:    $(HACK_H)
  1856. X$(OBJ)\pickup.1:    $(HACK_H)
  1857. X$(OBJ)\pickup.2-b:    $(HACK_H)
  1858. X$(OBJ)\polyself.0-1:    $(HACK_H)
  1859. X$(OBJ)\polyself.2-b:    $(HACK_H)
  1860. X$(OBJ)\potion.o:    $(HACK_H)
  1861. X$(OBJ)\pray.o:        $(HACK_H)
  1862. X$(OBJ)\pri.0:        $(HACK_H)   $(INCL)\epri.h     $(INCL)\termcap.h
  1863. X$(OBJ)\pri.1:        $(HACK_H)   $(INCL)\epri.h     $(INCL)\termcap.h
  1864. X$(OBJ)\pri.2:        $(HACK_H)   $(INCL)\epri.h     $(INCL)\termcap.h
  1865. X$(OBJ)\pri.b:        $(HACK_H)   $(INCL)\epri.h     $(INCL)\termcap.h
  1866. X$(OBJ)\priest.0:    $(HACK_H)   $(INCL)\mfndpos.h     $(INCL)\eshk.h \
  1867. X            $(INCL)\epri.h
  1868. X$(OBJ)\priest.1-b:    $(HACK_H)   $(INCL)\mfndpos.h     $(INCL)\eshk.h \
  1869. X            $(INCL)\epri.h
  1870. X$(OBJ)\prisym.0:    $(HACK_H)   $(INCL)\lev.h     $(INCL)\wseg.h
  1871. X$(OBJ)\prisym.1:    $(HACK_H)   $(INCL)\lev.h     $(INCL)\wseg.h
  1872. X$(OBJ)\prisym.2:    $(HACK_H)   $(INCL)\lev.h     $(INCL)\wseg.h
  1873. X$(OBJ)\prisym.b:    $(HACK_H)   $(INCL)\lev.h     $(INCL)\wseg.h
  1874. X$(OBJ)\random.o:
  1875. X$(OBJ)\read.0:        $(HACK_H)
  1876. X$(OBJ)\read.1-b:    $(HACK_H)
  1877. X$(OBJ)\restore.o:    $(HACK_H)   $(INCL)\lev.h     $(INCL)\wseg.h
  1878. X$(OBJ)\rip.o:        $(HACK_H)
  1879. X$(OBJ)\rnd.0:        $(HACK_H)
  1880. X$(OBJ)\rnd.1:        $(HACK_H)
  1881. X$(OBJ)\rnd.2-b:     $(HACK_H)
  1882. X$(OBJ)\rumors.o:    $(HACK_H)
  1883. X$(OBJ)\save.o:        $(HACK_H)   $(INCL)\lev.h     $(INCL)\wseg.h
  1884. X$(OBJ)\search.0:    $(HACK_H)   $(INCL)\artifact.h
  1885. X$(OBJ)\search.1-b:    $(HACK_H)   $(INCL)\artifact.h
  1886. X$(OBJ)\shk.0:        $(HACK_H)   $(INCL)\eshk.h
  1887. X$(OBJ)\shk.1-b:     $(HACK_H)   $(INCL)\eshk.h
  1888. X$(OBJ)\shknam.0:    $(HACK_H)   $(INCL)\eshk.h
  1889. X$(OBJ)\shknam.1-b:    $(HACK_H)   $(INCL)\eshk.h
  1890. X$(OBJ)\sit.o:        $(HACK_H)
  1891. X$(OBJ)\sounds.0:    $(HACK_H)   $(INCL)\edog.h     $(INCL)\eshk.h
  1892. X$(OBJ)\sounds.1-b:    $(HACK_H)   $(INCL)\edog.h     $(INCL)\eshk.h
  1893. X$(OBJ)\sp_lev.o:    $(HACK_H)   $(INCL)\sp_lev.h
  1894. X$(OBJ)\spell.o:     $(HACK_H)
  1895. X$(OBJ)\steal.0-1:    $(HACK_H)
  1896. X$(OBJ)\steal.2-b:    $(HACK_H)
  1897. X$(OBJ)\termcap.0:    $(HACK_H)   $(INCL)\termcap.h
  1898. X$(OBJ)\termcap.1:    $(HACK_H)   $(INCL)\termcap.h
  1899. X$(OBJ)\termcap.2-b:    $(HACK_H)   $(INCL)\termcap.h
  1900. X$(OBJ)\timeout.0:    $(HACK_H)
  1901. X$(OBJ)\timeout.1-b:    $(HACK_H)
  1902. X$(OBJ)\topl.0:        $(HACK_H)
  1903. X$(OBJ)\topl.1-2:    $(HACK_H)
  1904. X$(OBJ)\topl.b:        $(HACK_H)
  1905. X$(OBJ)\topten.o:    $(HACK_H)
  1906. X$(OBJ)\track.0:     $(HACK_H)
  1907. X$(OBJ)\track.1:     $(HACK_H)
  1908. X$(OBJ)\track.2-b:    $(HACK_H)
  1909. X$(OBJ)\trampoli.o:    $(HACK_H)
  1910. X$(OBJ)\trap.0-1:    $(HACK_H)   $(INCL)\edog.h
  1911. X$(OBJ)\trap.2:        $(HACK_H)   $(INCL)\edog.h
  1912. X$(OBJ)\trap.b:        $(HACK_H)   $(INCL)\edog.h
  1913. X$(OBJ)\u_init.o:    $(HACK_H)
  1914. X$(OBJ)\uhitm.o:     $(HACK_H)   $(INCL)\artifact.h
  1915. X$(OBJ)\vault.0:     $(HACK_H)   $(INCL)\vault.h
  1916. X$(OBJ)\vault.1-b:    $(HACK_H)   $(INCL)\vault.h
  1917. X$(OBJ)\version.o:    $(HACK_H)   $(INCL)\date.h     $(INCL)\patchlev.h
  1918. X$(OBJ)\weapon.0-1:    $(HACK_H)
  1919. X$(OBJ)\weapon.2-b:    $(HACK_H)
  1920. X$(OBJ)\were.0:        $(HACK_H)
  1921. X$(OBJ)\were.1-b:    $(HACK_H)
  1922. X$(OBJ)\wield.o:     $(HACK_H)
  1923. X$(OBJ)\wizard.0:    $(HACK_H)
  1924. X$(OBJ)\wizard.1-b:    $(HACK_H)
  1925. X$(OBJ)\worm.o:        $(HACK_H)   $(INCL)\wseg.h
  1926. X$(OBJ)\worn.o:        $(HACK_H)
  1927. X$(OBJ)\write.o:     $(HACK_H)
  1928. X$(OBJ)\zap.o:        $(HACK_H)
  1929. END_OF_FILE
  1930. if test 24531 -ne `wc -c <'others/Makefile.ovl'`; then
  1931.     echo shar: \"'others/Makefile.ovl'\" unpacked with wrong size!
  1932. fi
  1933. # end of 'others/Makefile.ovl'
  1934. echo shar: Extracting \"'vms/vmsbuild.com'\" \(8030 characters\)
  1935. sed "s/^X//" >'vms/vmsbuild.com' <<'END_OF_FILE'
  1936. X$ ! vms/vmsbuild.com -- compile and link NetHack 3.0 patchlevel 8    [pr]
  1937. X$ !
  1938. X$ ! usage:
  1939. X$ !   $ set default [.src]    !or [-.src] if starting from [.vms]
  1940. X$ !   $ @[-.vms]vmsbuild  [compiler-option]  [link-option]  [cc-switches]
  1941. X$ ! options:
  1942. X$ !    compiler-option :  either "VAXC" or "GNUC" or ""    !default VAXC
  1943. X$ !    link-option    :  either "SHARE[able]" or "LIB[rary]"    !default SHARE
  1944. X$ !    cc-switches    :  optional qualifiers for CC (such as "/noOpt/Debug")
  1945. X$ ! notes:
  1946. X$ !    If the symbol "CC" is defined, compiler-option is not used.
  1947. X$ !    The link-option refers to VAXCRTL (C Run-Time Library) handling;
  1948. X$ !      to specify it while letting compiler-option default, use "" as
  1949. X$ !      the compiler-option.
  1950. X$ !    To re-link without compiling, use "LINK" as special 'compiler-option';
  1951. X$ !      to re-link with GNUC library, 'CC' must begin with "G" (or "g").
  1952. X$ !    Default wizard definition moved to include/vmsconf.h.
  1953. X$
  1954. X$    vaxc_ = "CC/NOLIST/OPTIMIZE=NOINLINE"        !vaxc v3.x (2.x fixed below)
  1955. X$    gnuc_ = "GCC/CC1=""-fwritable-strings"""
  1956. X$    gnulib = "gnu_cc:[000000]gcclib/Library"    !(not used w/ vaxc)
  1957. X$ ! common CC options (/obj=file doesn't work for GCC 1.36, use rename instead)
  1958. X$    c_c_  = "/INCLUDE=[-.INCLUDE]"    !/DEFINE=(""WIZARD=""""GENTZEL"""""")
  1959. X$    if f$extract(1,3,f$getsyi("VERSION")).lts."4.6" then -
  1960. X$        c_c_ = c_c_ + "/DEFINE=(""VERYOLD_VMS"")"
  1961. X$ ! miscellaneous setup
  1962. X$    ivqual = %x00038240    !DCL-W-IVQUAL (used to check for ancient vaxc)
  1963. X$    abort := exit %x1000002A
  1964. X$ ! validate first parameter
  1965. X$    p1 := 'p1'
  1966. X$    c_opt = f$locate("|"+p1, "|VAXC|GNUC|LINK|SPECIAL|") !5
  1967. X$     if (c_opt/5)*5 .eq. c_opt then  goto p1_ok
  1968. X$    copy sys$input: sys$error:    !p1 usage
  1969. X%first arg is compiler option; it must be one of
  1970. X       "VAXC" -- use VAX C to compile everything
  1971. X   or  "GNUC" -- use GNU C to compile everything
  1972. X   or  "LINK" -- skip compilation, just relink nethack.exe
  1973. X   or  "SPEC[IAL]" -- just compile and link lev_comp.exe
  1974. X   or    ""   -- default operation (VAXC unless 'CC' is defined)
  1975. X
  1976. XNote: if a DCL symbol for CC is defined, "VAXC" and "GNUC" are no-ops.
  1977. X      If the symbol value begins with "G" (or "g"), then the GNU C
  1978. X      library will be included in all link operations.  Do not rebuild
  1979. X      lev_comp with "SPECIAL" unless you have a CC symbol setup with
  1980. X      the proper options.
  1981. X$    abort
  1982. X$p1_ok:
  1983. X$ ! validate second parameter
  1984. X$    p2 := 'p2'
  1985. X$    l_opt = f$locate("|"+p2, "|SHAREABLE|LIBRARY__|") !10
  1986. X$     if (l_opt/10)*10 .eq. l_opt then    goto p2_ok
  1987. X$    copy sys$input: sys$error:    !p2 usage
  1988. X%second arg is VAXCRTL handling; it must be one of
  1989. X       "SHAREABLE" -- link with SYS$SHARE:VAXCRTL.EXE/SHAREABLE
  1990. X   or   "LIBRARY"  -- link with SYS$LIBRARY:VAXCRTL.OLB/LIBRARY
  1991. X   or      ""      -- default operation (use shareable image)
  1992. X
  1993. XNote: for MicroVMS 4.x, "SHAREABLE" (which is the default) is required.
  1994. X$    abort
  1995. X$p2_ok:
  1996. X$ ! compiler setup; if a symbol for "CC" is already defined it will be used
  1997. X$     if f$type(cc).eqs."STRING" then  goto got_cc
  1998. X$    cc = vaxc_            !assume "VAXC" requested or defaulted
  1999. X$    if c_opt.eq.5 then  cc = gnuc_    !explicitly invoked w/ "GNUC" option
  2000. X$    if c_opt.ne.0 then  goto got_cc !"GNUC" or "LINK", skip compiler check
  2001. X$    ! we want to prevent function inlining with vaxc v3.x (/opt=noinline)
  2002. X$    !   but we can't use noInline with v2.x, so need to determine version
  2003. X$      set noOn
  2004. X$      msgenv = f$environment("MESSAGE")
  2005. X$      set message/noFacil/noSever/noIdent/noText
  2006. X$      cc/noObject _NLA0:/Include=[]     !strip 'noinline' if error
  2007. X$      sts = $status
  2008. X$    if sts then  goto reset_msg    !3.0 or later will check out OK
  2009. X$    ! must be dealing with vaxc 2.x; ancient version (2.2 or earlier)
  2010. X$    !   can't handle /include='dir', needs c$include instead
  2011. X$      cc = cc - "=NOINLINE" - ",NOINLINE" - "NOINLINE,"
  2012. X$      if sts.ne.IVQUAL then  goto reset_msg
  2013. X$        define/noLog c$include [-.INCLUDE]
  2014. X$        c_c_ = "/DEFINE=(""ANCIENT_VAXC"")"
  2015. X$        if f$extract(1,3,f$getsyi("VERSION")).lts."4.6" then -
  2016. X$        c_c_ = c_c_ - ")" + ",""VERYOLD_VMS"")"
  2017. X$reset_msg:
  2018. X$      set message 'msgenv'
  2019. X$      set On
  2020. X$got_cc:
  2021. X$    cc = cc + c_c_            !append common qualifiers
  2022. X$    if p3.nes."" then  cc = cc + p3 !append optional user preferences
  2023. X$    g := 'f$extract(0,1,cc)'
  2024. X$    if g.nes."G" then  gnulib = ""
  2025. X$    if g.eqs."G" then  gnulib = "," + gnulib
  2026. X$ ! linker setup; if a symbol for "LINK" is defined, we'll use it
  2027. X$    if f$type(link).nes."STRING" then  link = "LINK/NOMAP"
  2028. X$    if p4.nes."" then  link = link + p4 !append optional user preferences
  2029. X$    vaxcrtl = "sys$library:vaxcrtl.olb/Library"    !object library
  2030. X$     if l_opt.ne.0 then  goto vaxcrtl_ok
  2031. X$    vaxcrtl = "sys$disk:[]vaxcrtl.opt/Options"    !shareable image
  2032. X$     if f$search("vaxcrtl.opt").nes."" then  goto vaxcrtl_ok !assume its right
  2033. X$    create sys$disk:[]vaxcrtl.opt
  2034. Xsys$share:vaxcrtl/Shareable
  2035. Xsys$library:vaxcrtl/Library    !/Include=C$$TRANSLATE    !for link() substitute
  2036. X$vaxcrtl_ok:
  2037. X$ ! final setup
  2038. X$    nethacklib = "nethack.olb"
  2039. X$    milestone = "write sys$output f$fao("" !5%T "",0),"
  2040. X$     if c_opt.eq.10 then  goto link    !"LINK" requested, skip compilation
  2041. X$    rename     := rename/New_Vers
  2042. X$    touch     := set file/Truncate
  2043. X$    makedefs := $sys$disk:[]makedefs
  2044. X$    show symbol cc
  2045. X$!
  2046. X$!  compile and link makedefs, then nethack, finally lev_comp.
  2047. X$!
  2048. X$ milestone "<compiling...>"
  2049. X$ cc [-.vms]vmsmisc    !try simplest one first
  2050. X$ cc alloc.c
  2051. X$ if f$search("monst.c").eqs."" then  copy/Concat monst.c1+.c2 *.c
  2052. X$ cc monst.c
  2053. X$ milestone " (monst)"
  2054. X$ cc objects.c
  2055. X$     if c_opt.eq.15 then  goto special !"SPECIAL" requested, skip main build
  2056. X$ cc makedefs.c
  2057. X$ link makedefs.obj,monst.obj,objects.obj,vmsmisc.obj,-
  2058. X    'vaxcrtl''gnulib',sys$input:/Opt
  2059. Xidentification="makedefs 3.0.8"
  2060. X$ milestone "makedefs"
  2061. X$! create some build-time files
  2062. X$ makedefs -p    !pm.h
  2063. X$ makedefs -o    !onames.h
  2064. X$ makedefs -t    !trap.h
  2065. X$ makedefs -v    !date.h
  2066. X$! create new object library
  2067. X$ libr/Obj 'nethacklib'/Create=(Block=2000,Hist=2) vmsmisc.obj,alloc.obj/Insert
  2068. X$ if f$search(f$parse(".olb;-2",nethacklib)).nes."" then -
  2069. X$    purge/Keep=2 'nethacklib'
  2070. X$! compile most of the source files:
  2071. X$ c1 = "decl,version,[-.vms]vmsmain,[-.vms]vmsunix,[-.vms]vmstty," -
  2072. X      + "[-.others]random,[-.vms]vmstparam"
  2073. X$ c2 = "allmain,apply,artifact,attrib,bones,cmd,dbridge,demon,do,do_name," -
  2074. X      + "do_wear,dog,dogmove,dokick,dothrow,eat,end,engrave,exper,extralev"
  2075. X$ c3 = "fountain,getline,hack,invent,lock,mail,makemon,mcastu,mhitm,mhitu," -
  2076. X      + "mklev,mkmaze,mkobj,mkroom,mon,mondata,monmove,mthrowu,music,o_init"
  2077. X$ c4 = "objnam,options,pager,pickup,polyself,potion,pray,pri,priest,prisym," -
  2078. X      + "read,restore,rip,rnd,rumors,save,search,shk,shknam,sit,sounds,sp_lev"
  2079. X$ c5 = "spell,steal,termcap,timeout,topl,topten,track,trap,u_init,uhitm," -
  2080. X      + "vault,weapon,were,wield,wizard,worm,worn,write,zap"
  2081. X$! process all 5 lists of files
  2082. X$   i = 1
  2083. X$list_loop:
  2084. X$     list = c'i'    !get next list
  2085. X$     j = 0
  2086. X$file_loop:
  2087. X$    file = f$element(j,",",list)    !get next file
  2088. X$    if file.eqs."" .or. file.eqs."," then  goto list_done
  2089. X$    cc 'file'.c
  2090. X$    if f$extract(0,1,file).eqs."[" then -
  2091. X$        file = f$edit(f$parse(file,,,"NAME"),"LOWERCASE")
  2092. X$    libr/Obj 'nethacklib' 'file'.obj/Insert
  2093. X$    delete 'file'.obj;*
  2094. X$    milestone " (",file,")"
  2095. X$    j = j + 1
  2096. X$     goto file_loop
  2097. X$list_done:
  2098. X$     i = i + 1
  2099. X$   if i.le.5 then  goto list_loop
  2100. X$! one special case left
  2101. X$ cc [-.vms]vmstermcap.c -
  2102. X    /Define=("bcopy(s,d,n)=memcpy((d),(s),(n))","exit=vms_exit")
  2103. X$ libr/Obj 'nethacklib' vmstermcap.obj/Insert
  2104. X$!
  2105. X$link:
  2106. X$ milestone "<linking...>"
  2107. X$ link/Exe=nethack 'nethacklib'/Lib/Incl=(vmsmain,allmain,vmsunix,vmstty,decl),-
  2108. X    sys$disk:[]monst.obj,objects.obj,-    !(data-only modules, like decl)
  2109. X    sys$input:/Opt,'vaxcrtl''gnulib'
  2110. Xidentification="NetHack 3.0.8"
  2111. X$ milestone "NetHack"
  2112. X$     if c_opt.eq.10 then  goto done    !"LINK" only
  2113. X$special:
  2114. X$!
  2115. X$! build special level compiler
  2116. X$!
  2117. X$ cc lev_main.c
  2118. X$ cc lev_comp.c
  2119. X$ copy [-.vms]lev_lex.h stdio.*/Prot=(s:rwd,o:rwd)
  2120. X$ cc lev_lex.c
  2121. X$ rename stdio.h lev_lex.*
  2122. X$ cc panic.c
  2123. X$ link lev_comp.obj,lev_lex.obj,lev_main.obj,-
  2124. X    monst.obj,objects.obj,alloc.obj,panic.obj,vmsmisc.obj,-
  2125. X    'vaxcrtl''gnulib',sys$input:/Opt
  2126. Xidentification="lev_comp 3.0.8"
  2127. X$ milestone "lev_comp"
  2128. X$!
  2129. X$done:
  2130. X$ exit
  2131. END_OF_FILE
  2132. if test 8030 -ne `wc -c <'vms/vmsbuild.com'`; then
  2133.     echo shar: \"'vms/vmsbuild.com'\" unpacked with wrong size!
  2134. fi
  2135. # end of 'vms/vmsbuild.com'
  2136. echo shar: End of archive 22 \(of 24\).
  2137. cp /dev/null ark22isdone
  2138. MISSING=""
  2139. for I in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 ; do
  2140.     if test ! -f ark${I}isdone ; then
  2141.     MISSING="${MISSING} ${I}"
  2142.     fi
  2143. done
  2144. if test "${MISSING}" = "" ; then
  2145.     echo You have unpacked all 24 archives.
  2146.     rm -f ark[1-9]isdone ark[1-9][0-9]isdone
  2147. else
  2148.     echo You still need to unpack the following archives:
  2149.     echo "        " ${MISSING}
  2150. fi
  2151. ##  End of shell archive.
  2152. exit 0
  2153.